Re: [Tutor] python2 vs python3 urllib

2011-04-25 Thread pierre dagenais
On 11-04-23 06:58 PM, pierre dagenais wrote: The following code works as expected with python version 2.6.5, but with version 3.1.2 I get the following error: pierre:/MyCode/mesProjets$ py3 test.py Traceback (most recent call last): File test.py, line 3, in module sock =

[Tutor] python2 vs python3 urllib

2011-04-23 Thread pierre dagenais
The following code works as expected with python version 2.6.5, but with version 3.1.2 I get the following error: pierre:/MyCode/mesProjets$ py3 test.py Traceback (most recent call last): File test.py, line 3, in module sock = urllib.urlopen(http://diveintopython.org/;) AttributeError:

Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread Noah Hall
On Sat, Apr 23, 2011 at 11:58 PM, pierre dagenais eq...@ncf.ca wrote: The following code works as expected with python version 2.6.5, but with version 3.1.2 I get the following error: pierre:/MyCode/mesProjets$ py3 test.py Traceback (most recent call last):  File test.py, line 3, in module

Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread Alan Gauld
pierre dagenais eq...@ncf.ca wrote sock = urllib.urlopen(http://diveintopython.org/;) AttributeError: 'module' object has no attribute 'urlopen' What is the proper syntax in version 3? using help() shows that urllib has become a package in v3. The request module looked promising and

Re: [Tutor] python2 vs python3 urllib

2011-04-23 Thread wesley chun
i strongly recommend you consider using the 2to3 tool if porting apps from 2.x to 3.x... it will show you much more than you may think. here's the output from the 2.7 version of 2to3: $ 2to3 test.py RefactoringTool: Skipping implicit fixer: buffer RefactoringTool: Skipping implicit fixer: idioms