On Fri, Jul 3, 2009 at 10:37 PM, Fabian Pedregosa<[email protected]> wrote:
>
> Fabian Pedregosa wrote:
>> Ondrej Certik wrote:
>>> Hi,
>>>
>>> I fixed the import problems, so things should now work in python3,
>>> except that the 2to3 tool breaks. :(
>>>
>>> checkout my py3-prepare branch:
>>>
>>> http://github.com/certik/sympy/tree/py3-prepare
>>>
>>> and run the 2to3 tool:
>>>
>>> $ python3.1 ~/ext/Python-3.1/Tools/scripts/2to3  . > p
>>> RefactoringTool: Skipping implicit fixer: buffer
>>> RefactoringTool: Skipping implicit fixer: idioms
>>> RefactoringTool: Skipping implicit fixer: set_literal
>>> RefactoringTool: Skipping implicit fixer: ws_comma
>>> RefactoringTool: Can't parse ./data/IPython/ipythonrc-sympy:
>>> ParseError: bad input: type=1, value='ipythonrc', context=(' ', (25,
>>> 8))
>>> RefactoringTool: Can't parse
>>> ./doc/src/modules/galgebra/GA/BasicGAtest.py: ParseError: bad input:
>>> type=5, value='        ', context=('', (1, 0))
>>> RefactoringTool: Can't parse
>>> ./doc/src/modules/galgebra/GA/conformalgeometryGAtest.py: ParseError:
>>> bad input: type=5, value='        ', context=('', (1, 0))
>>> RefactoringTool: Can't parse
>>> ./doc/src/modules/galgebra/GA/headerGAtest.py: ParseError: bad input:
>>> type=0, value='', context=('\n', (26, 0))
>>> RefactoringTool: Can't parse
>>> ./doc/src/modules/galgebra/GA/hyperbolicGAtest.py: ParseError: bad
>>> input: type=5, value='        ', context=('', (1, 0))
>>> RefactoringTool: Can't parse
>>> ./doc/src/modules/galgebra/GA/reciprocalframeGAtest.py: ParseError:
>>> bad input: type=5, value='        ', context=('', (1, 0))
>>> Traceback (most recent call last):
>>>   File "/home/ondrej/ext/Python-3.1/Tools/scripts/2to3", line 6, in <module>
>>>     sys.exit(main("lib2to3.fixes"))
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/main.py", line 132, in main
>>>     options.processes)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 544, in refactor
>>>     items, write, doctests_only)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 207, in refactor
>>>     self.refactor_dir(dir_or_file, write, doctests_only)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 225, in refactor_dir
>>>     self.refactor_file(fullname, write, doctests_only)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 584, in refactor_file
>>>     *args, **kwargs)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 264, in refactor_file
>>>     write=write, encoding=encoding)
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/refactor.py", line
>>> 363, in processed_file
>>>     self.print_output(diff_texts(old_text, new_text, filename))
>>>   File "/home/ondrej/ext/Python-3.1/Lib/lib2to3/main.py", line 47, in
>>> print_output
>>>     print(line)
>>> UnicodeEncodeError: 'ascii' codec can't encode character '\u03b1' in
>>> position 32: ordinal not in range(128)
>>>
>>>
>>> The tool from python2.6 works, but fails to convert the imports, so it
>>> doesn't work in python3. (they fixed that in later 2to3 tool that is
>>> in python3.1, but it fails with the above unicode problem). If someone
>>> could look into that, it'd be awesome. I think we are very close to
>>> gettting sympy run in python3.
>>
>> That's because this bug in 2to3: http://bugs.python.org/issue5093
>>
>> Using the workaround it all gets converted, and I pushed my changes to
>> http://fseoane.net/git/sympy.git, branch py3
>>
>> However, I am getting some problems with string.strip() when importing
>> sympy:
>>
>>  >>> import sympy
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>>    File "sympy/__init__.py", line 23, in <module>
>>      from sympy.core import *
>>    File "sympy/core/__init__.py", line 4, in <module>
>>      from .basic import Basic, S, C, sympify
>>    File "sympy/core/basic.py", line 3, in <module>
>>      import sympy.mpmath as mpmath
>>    File "sympy/mpmath/__init__.py", line 3, in <module>
>>      from .mptypes import (
>>    File "sympy/mpmath/mptypes.py", line 40, in <module>
>>      from string import strip
>> ImportError: cannot import name strip
>>
>> I suppose we should be using string.format or something similar,
>> http://docs.python.org/3.1/library/string.html
>
> update, I got this to work, just needed to use the classmethod strip()
> instead of the one in the string module. Did some other fixes (it's in
> my repo), but now I am blocked on this:
>
>
>  >>> import sympy
> Traceback (most recent call last):
>   File "sympy/core/decorators.py", line 73, in __sympifyit_wrapper
>     return func(a, b)
>   File "sympy/core/basic.py", line 662, in __rmul__
>     return Mul(other, self)
>   File "sympy/core/cache.py", line 82, in wrapper
>     return func_cache_it_cache[k]
> TypeError: unhashable type: 'Integer'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "sympy/__init__.py", line 25, in <module>
>     from .polys import *
>   File "sympy/polys/__init__.py", line 2, in <module>
>     from .monomial import monomials, monomial_count
>   File "sympy/polys/monomial.py", line 6, in <module>
>     from sympy.functions import factorial
>   File "sympy/functions/__init__.py", line 11, in <module>
>     from . import special
>   File "sympy/functions/special/__init__.py", line 8, in <module>
>     from . import polynomials
>   File "sympy/functions/special/polynomials.py", line 102, in <module>
>     class chebyshevu(PolynomialSequence):
>   File "sympy/functions/special/polynomials.py", line 121, in chebyshevu
>     @recurrence_memo([S.One, 2*_x])
>   File "sympy/core/decorators.py", line 100, in __sympifyit_wrapper
>     return func(a, b)
>   File "sympy/core/basic.py", line 662, in __rmul__
>     return Mul(other, self)
>   File "sympy/core/cache.py", line 82, in wrapper
>     return func_cache_it_cache[k]
> TypeError: unhashable type: 'Integer'

This seems more serious, we will have to investigate it. In my branch
I also had to apply couple cmp() fixes, see the python 3.0 issue.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to