python-2to3

Porting cython files from python2 to python3 with 2to3

China☆狼群 提交于 2021-02-08 19:47:10
问题 I have a python package which was developed under python2.7, but I need to port it to python3.6 . I use cython in some parts of the code, hence the package has both .py and .pyx files. I tried the 2to3 command, but I got an error that I couldn't neither understand nor solve. Example: I have the following test.pyx file # cython: profile=False cimport cython @cython.boundscheck(False) @cython.wraparound(False) @cython.profile(False) cpdef sillyfunction(): print 'Thank you for your kind help'

How to fix “.dist-info directory not found” in my package?

∥☆過路亽.° 提交于 2021-01-22 10:32:29
问题 I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nobody left on the team is able to help out. After running 2to3 on the files of the package, I ran python setup.py sdist to create a package, placed the package in a local repository, then attempted to use pip install to install the package. It ended up erroring out with the following: Exception:

How to fix “.dist-info directory not found” in my package?

馋奶兔 提交于 2021-01-22 10:29:28
问题 I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nobody left on the team is able to help out. After running 2to3 on the files of the package, I ran python setup.py sdist to create a package, placed the package in a local repository, then attempted to use pip install to install the package. It ended up erroring out with the following: Exception:

TypeError: can't concat str to bytes when converting Python 2 to 3 with Encryption Function

天涯浪子 提交于 2020-02-29 09:46:36
问题 I am trying to transfer a code from python2 to 3. The problem happens. "pad * chr(pad)" looks like a string but when I print it out it shows . I dont know what it is really is. <ipython-input-26-6c9679723473> in aesEncrypt(text, secKey) 43 def aesEncrypt(text, secKey): 44 pad = 16 - len(text) % 16 ---> 45 text =text + pad * chr(pad) 46 encryptor = AES.new(secKey, 2, '0102030405060708') 47 ciphertext = encryptor.encrypt(text) TypeError: can't concat str to bytes I then tried encode() but it

TypeError: can't concat str to bytes when converting Python 2 to 3 with Encryption Function

妖精的绣舞 提交于 2020-02-29 09:44:57
问题 I am trying to transfer a code from python2 to 3. The problem happens. "pad * chr(pad)" looks like a string but when I print it out it shows . I dont know what it is really is. <ipython-input-26-6c9679723473> in aesEncrypt(text, secKey) 43 def aesEncrypt(text, secKey): 44 pad = 16 - len(text) % 16 ---> 45 text =text + pad * chr(pad) 46 encryptor = AES.new(secKey, 2, '0102030405060708') 47 ciphertext = encryptor.encrypt(text) TypeError: can't concat str to bytes I then tried encode() but it

Porting a Python 2.X based project to Python 3 [closed]

拈花ヽ惹草 提交于 2020-01-04 15:25:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I want to port a web application scanning framework from Python 2.6.5-2.7.3 to Python 3 without causing much harm to the compatibility with Python 2.6+ . I have read briefly about six: Python 2 and 3 Compatibility Library and python-modernize . The framework I am intending to port