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 =
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:
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
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
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