Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 #7

Open
irinatu opened this issue Jun 29, 2022 · 3 comments
Open

python3 #7

irinatu opened this issue Jun 29, 2022 · 3 comments

Comments

@irinatu
Copy link

irinatu commented Jun 29, 2022

Do you consider to adapt the program to python3?

@Psirving
Copy link
Member

Hello again! A python3 version is being developed. If you used git clone to install Superfold, you can switch to python3 by typing git checkout python3 from the Superfold directory. It has not been tested in any way yet, so you might encounter errors.

@irinatu
Copy link
Author

irinatu commented Jul 7, 2022

Hello, unfortunately it is not enough. When I jus run Superfold for python3 version I obtained:
Superfold.py Sim.map
/home/irina/bin/Superfold/Superfold.py:83: DeprecationWarning: 'U' mode is deprecated
for line in open(fIN, "rU").readlines():
Traceback (most recent call last):
File "/home/irina/bin/Superfold/Superfold.py", line 1421, in
main()
File "/home/irina/bin/Superfold/Superfold.py", line 113, in main
args = parseArgs()
File "/home/irina/bin/Superfold/Superfold.py", line 740, in parseArgs
m.update(str(o.mapFile))
TypeError: Strings must be encoded before hashing

After changing "rU" to newline=None or newline='':
Superfold.py Sim.map
Traceback (most recent call last):
File "/home/irina/bin/Superfold/Superfold.py", line 1421, in
main()
File "/home/irina/bin/Superfold/Superfold.py", line 113, in main
args = parseArgs()
File "/home/irina/bin/Superfold/Superfold.py", line 740, in parseArgs
m.update(str(o.mapFile))
TypeError: Strings must be encoded before hashing:

@Psirving
Copy link
Member

Psirving commented Jul 7, 2022

This has something to do with how strings are encoded in python2 vs python3. Lines 740-747 should be something like m.update(o.variableName.encode('utf-8')) instead of m.update(str(o.variableName)). I can't guarantee that will work or that you won't encounter more errors.

'U' mode was not causing the error, only a warning. Since 'U' mode is the new default, python is telling you that it is not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants