Ich habe ein Python-Paket, das unter Python2.7 entwickelt wurde, aber ich muss es nach Python3.6 portieren. Ich verwende Cython in einigen Teilen des Codes, daher hat das Paket sowohl .py
als auch .pyx
Dateien.Portierung von Cython-Dateien von Python2 nach Python3 mit 2to3
Ich habe versucht, die 2to3
Befehl, aber ich habe einen Fehler, den ich weder verstehen noch lösen konnte.
Beispiel: Ich habe folgende test.pyx
Datei
# cython: profile=False
cimport cython
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.profile(False)
cpdef sillyfunction():
print 'Thank you for your kind help'
return
und ich laufe 2to3 test.pyx
. Was ich erhalte, ist:
[email protected]:~$ 2to3 test.pyx
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Can't parse test.pyx: ParseError: bad input: type=1, value=u'cython', context=(u' ', (2, 8))
RefactoringTool: No files need to be modified.
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse test.pyx: ParseError: bad input: type=1, value=u'cython', context=(u' ', (2, 8))