[Numpy-discussion] Python 3 porting

Bruce Southey bsouthey@gmail....
Tue Feb 16 12:11:01 CST 2010


On 02/15/2010 10:55 AM, Pauli Virtanen wrote:
> ma, 2010-02-15 kello 10:18 -0600, Bruce Southey kirjoitti:
> [clip]
>    
>> Is there a correct way to get Python3.1 to find the relative path on Linux?
>> I can change the import statement to work but I do not think that is viable.
>>      
> You need to use relative imports. 2to3 should be able to take care of
> this.
>
> [clip]
>    
>>     File "/usr/local/lib/python3.1/site-packages/numpy/lib/__init__.py",
>> line 1, in<module>
>>       from info import __doc__
>> ImportError: No module named info
>>      
> That statement should read
>
> 	from .info import __doc__
>
> and indeed, it reads like that for me. Check how it is in
> build/py3k/numpy/lib/__init__.py
>
> Most likely you interrupted the build by Ctrl+C and 2to3 did not finish
> the conversion of the files to Python3 format. Try removing the build/
> directory and trying again -- if you interrupt it, 2to3 may not have
> finished running.
>
> Of course, it should be more robust, but at the moment, it isn't
> (patches welcome).
>
>    
Hi,
I managed to get 2to3 (I think from Python 3.1) to crash and isolated it 
to the file numpy-work/numpy/lib/arrayterator.py

So I might hitting this ' assertion error in 2to3' bug:
http://bugs.python.org/issue7824

I try to get the latest version of 2to3 and try again.

Bruce

$ 2to3 -w arrayterator.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
Traceback (most recent call last):
   File "/usr/local/bin/2to3", line 6, in <module>
     sys.exit(main("lib2to3.fixes"))
   File "/usr/local/lib/python3.1/lib2to3/main.py", line 159, in main
     options.processes)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 616, in 
refactor
     items, write, doctests_only)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 276, in 
refactor
     self.refactor_file(dir_or_file, write, doctests_only)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 656, in 
refactor_file
     *args, **kwargs)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 328, in 
refactor_file
     tree = self.refactor_string(input, filename)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 358, in 
refactor_string
     self.refactor_tree(tree, name)
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 392, in 
refactor_tree
     self.traverse_by(self.post_order_heads, tree.post_order())
   File "/usr/local/lib/python3.1/lib2to3/refactor.py", line 418, in 
traverse_by
     node.replace(new)
   File "/usr/local/lib/python3.1/lib2to3/pytree.py", line 133, in replace
     assert self.parent is not None, str(self)
AssertionError:
     def __init__(self, var, buf_size=None):
         self.var = var
         self.buf_size = buf_size

         self.start = [0 for dim in var.shape]
         self.stop = [dim for dim in var.shape]
         self.step = [1 for dim in var.shape]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100216/17be04d8/attachment.html 


More information about the NumPy-Discussion mailing list