Re: [Tutor] Probably a silly question: how to install lxml?

2017-07-05 Thread Mark at information27.com
Wow. Thanks for those replies. Those red error messages were several Exceptions and one PermissionError. I THINK, but I'm not Positive that 3.6.1 is the only Python installed. I'm the only person who uses this PC. ControlPanel > UserAccounts says I am the Administrator. I se

Re: [Tutor] Probably a silly question: how to install lxml?

2017-07-05 Thread eryk sun
On Thu, Jul 6, 2017 at 1:51 AM, Steven D'Aprano wrote: > > I dunno, to me it sounds like it *didn't* work, not if it is printing > red error messages at the end. What do they say? lxml should install from a wheel (e.g. lxml-3.8.0-cp36-cp36m-win_amd64.whl). There's nothing to build, so the most li

Re: [Tutor] Probably a silly question: how to install lxml?

2017-07-05 Thread Steven D'Aprano
On Wed, Jul 05, 2017 at 11:42:45AM -0700, Mark at information27.com wrote: > On Windows7, SP1, 64-bit, I installed Python 3.6.1. Are you positive this is the only Python installed? What does python -c "import sys; print(sys.version)" do? > Tried to run the Python pgm, and it said ModuleNotF

Re: [Tutor] Why use main() ?

2017-07-05 Thread Danny Yoo
In most cases, my scripts tend to be pretty self-contained and written for my own purposes, so that would rarely be an issue. How would you hide main() if you _were_ concerned about it? The "main" option would be to move the body of main() to a separate file, which imports the original file as

Re: [Tutor] Probably a silly question: how to install lxml?

2017-07-05 Thread Ashfaq
Hi Mark ModuleNotFoundError means the package is not installed. Can you paste those red error message here? This can shed some light. Sincerely Ashfaq On Thu, Jul 6, 2017 at 5:10 AM Mark at information27.com < m...@information27.com> wrote: > First, I'm not a programmer, but I know a bit about p

[Tutor] Probably a silly question: how to install lxml?

2017-07-05 Thread Mark at information27.com
First, I'm not a programmer, but I know a bit about programming techniques. Had a Python pgm working about a year ago, and now trying to get it running on a new machine. On Windows7, SP1, 64-bit, I installed Python 3.6.1. Tried to run the Python pgm, and it said ModuleNotFoundError: No module n

Re: [Tutor] Why use main() ?

2017-07-05 Thread David Rock
* Mats Wichmann [2017-07-05 16:47]: > > > > As a vaguely contradictory position to a part of this (which I in the > main agree with): if your objective is to make a module, and also have > some code (perhaps including test code) which is run in the non-module > (aka not-imported) case, then stuf

Re: [Tutor] Why use main() ?

2017-07-05 Thread Mats Wichmann
On 07/05/2017 09:45 AM, Zachary Ware wrote: > On Wed, Jul 5, 2017 at 10:37 AM, David Rock wrote: >> I personally find using main() cumbersome, but many examples I come >> across use main(). Is there some fundamental benefit to using main() >> that I'm missing? > > In no particular order: testin

Re: [Tutor] Why use main() ?

2017-07-05 Thread David Rock
* Alan Gauld via Tutor [2017-07-05 20:36]: > On 05/07/17 16:37, David Rock wrote: > > > This is a question about the benefits of using a main() function vs not. > > > Others have answered for the pros, but I confess that I don't > always use a main(), but only if all I'm doing is, say, > instan

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Peter Otten
Ashfaq wrote: > Hi Peter, > The way you find the issue is really cool! Very cool! :) Thanks ;) Here's a bonus solution: >>> import unittest >>> class T(unittest.TestCase): ... def test_xy(self): ... self.maxDiff = None ... self.assertEqual(x, y) ... >>> unittest.main() F ==

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread shubham goyal
On Jul 5, 2017 11:09 PM, "shubham goyal" wrote: > Yha that's very smart. Only experience can drive you this way. Otherwise I > was checking value by value. > > On Jul 5, 2017 10:21 PM, "Ashfaq" wrote: > > Hi Peter, > The way you find the issue is really cool! Very cool! :) > > On Wed, Jul 5, 201

Re: [Tutor] Why use main() ?

2017-07-05 Thread Alan Gauld via Tutor
On 05/07/17 16:37, David Rock wrote: > This is a question about the benefits of using a main() function vs not. Others have answered for the pros, but I confess that I don't always use a main(), but only if all I'm doing is, say, instantiating a class and running a method. For anything more comp

Re: [Tutor] Why use main() ?

2017-07-05 Thread Danny Yoo
>> I personally find using main() cumbersome, but many examples I come >> across use main(). Is there some fundamental benefit to using main() >> that I'm missing? > > In no particular order: testing, encapsulation, and reusability. With > a "main()" function (which, recall, can be named whatever

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Danny Yoo
The difflib library (https://docs.python.org/2/library/difflib.html) can also help with some exploratory discovery of the problem. Here's an example: >>> import difflib >>> for line in difflib.context_diff(repr(x).split(','), repr(y).split(','

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Mats Wichmann
On 07/05/2017 11:09 AM, Marc Tompkins wrote: > On Wed, Jul 5, 2017 at 9:51 AM, Ashfaq wrote: > >> Hi Peter, >> The way you find the issue is really cool! Very cool! :) >> >> > I agree - that is very cool. But I have also made this sort of mistake a > few times, and found it by using a very quick

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Marc Tompkins
On Wed, Jul 5, 2017 at 9:51 AM, Ashfaq wrote: > Hi Peter, > The way you find the issue is really cool! Very cool! :) > > I agree - that is very cool. But I have also made this sort of mistake a few times, and found it by using a very quick, low-tech method... "Unfold" the lines of the two dictio

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Ashfaq
Hi Peter, The way you find the issue is really cool! Very cool! :) On Wed, Jul 5, 2017 at 6:10 PM, shubham goyal wrote: > Thank you Peter. > Silly mistakes 😀 > > On Jul 5, 2017 5:10 PM, "Peter Otten" <__pete...@web.de> wrote: > > > shubham goyal wrote: > > > > > null=None > > > x={'_udp_options'

Re: [Tutor] Why use main() ?

2017-07-05 Thread Zachary Ware
On Wed, Jul 5, 2017 at 10:37 AM, David Rock wrote: > This is not a question about using if __name__ == '__main__':. I know > what the difference is between running the script or importing it and > using the value of __name__ to determine behavior. > > This is a question about the benefits of usin

[Tutor] Why use main() ?

2017-07-05 Thread David Rock
This is not a question about using if __name__ == '__main__':. I know what the difference is between running the script or importing it and using the value of __name__ to determine behavior. This is a question about the benefits of using a main() function vs not. ie, if __name__ == '__main__

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread shubham goyal
Thank you Peter. Silly mistakes 😀 On Jul 5, 2017 5:10 PM, "Peter Otten" <__pete...@web.de> wrote: > shubham goyal wrote: > > > null=None > > x={'_udp_options': None, '_icmp_options': None, 'attribute_map': > > {'icmp_options': 'icmpOptions', 'protocol': 'protocol', 'source': > > {'source', > > 't

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Peter Otten
shubham goyal wrote: > null=None > x={'_udp_options': None, '_icmp_options': None, 'attribute_map': > {'icmp_options': 'icmpOptions', 'protocol': 'protocol', 'source': > {'source', > 'tcp_options': 'tcpOptions', 'is_stateless': 'isStateless', 'udp_options': > 'udpOptions'}, '_is_stateless': False,

[Tutor] dictionaries are same but returning false

2017-07-05 Thread shubham goyal
null=None x={'_udp_options': None, '_icmp_options': None, 'attribute_map': {'icmp_options': 'icmpOptions', 'protocol': 'protocol', 'source': 'source', 'tcp_options': 'tcpOptions', 'is_stateless': 'isStateless', 'udp_options': 'udpOptions'}, '_is_stateless': False, 'swagger_types': {'icmp_options':