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

> 
> Ondrej
> 
> > 
> 


-- 
http://fseoane.net/blog/

--~--~---------~--~----~------------~-------~--~----~
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