Open kylemcdonald opened 6 years ago
Hi, thanks for your reporting! This problem like https://stackoverflow.com/questions/33054527/python-3-5-typeerror-a-bytes-like-object-is-required-not-str-when-writing-t?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa.
So please try to changeopen(obj_name, 'wb')
to open(obj_name, 'w')
or open(obj_name, 'wt')
.
My env is python 2 now, so I haven't verified this method. Please tell me whether this can solve.
And, it seems @cclauss also uses python 3, can you please help me solve this issue?
run_basics.py
worked for me after changing the 'wb'
to 'w'
in 3 places:
https://github.com/YadiraF/PRNet/blob/master/utils/write.py#L31 https://github.com/YadiraF/PRNet/blob/master/utils/write.py#L66 https://github.com/YadiraF/PRNet/blob/master/utils/write.py#L89
Additionally, I had to create the directory AFLW2000
in TestImages/AFLW2000_results
to get TestImages/AFLW2000_results/AFLW2000
.
Standard 2to3
write on everything works bar the bytes-str issue. Either do str.encode('utf-8')
and b"my string"
or as @YadiraF suggests by removing byte writing mode ( more sensible ).
I have this working under Python 3 environment.
I had some issues in python 3 with the path but I think it's more coming from Windows where I have problem with not complete path and also / and \ in path
@alain2208 Windows path issues can usually be solved with judicious use of os.path.join() and/or os.sep. If you could please open a pull requests or at least an issue, that would help.
Is this issue still open?
it would be great to make this compatible with python 3!
i mentioned a problem in https://github.com/YadiraF/PRNet/issues/21 but wanted to start a fresh issue here.