python 3 compatibility
See original GitHub issueit 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.
$ python run_basics.py
2018-05-01 12:16:47.603620: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1349] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575
pciBusID: 0000:05:00.0
totalMemory: 10.91GiB freeMemory: 8.34GiB
2018-05-01 12:16:47.603651: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1428] Adding visible gpu devices: 0
2018-05-01 12:16:47.806106: I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-05-01 12:16:47.806140: I tensorflow/core/common_runtime/gpu/gpu_device.cc:922] 0
2018-05-01 12:16:47.806148: I tensorflow/core/common_runtime/gpu/gpu_device.cc:935] 0: N
2018-05-01 12:16:47.806319: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1046] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 8060 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:05:00.0, compute capability: 6.1)
2018-05-01 12:16:47.807380: I tensorflow/core/common_runtime/process_util.cc:64] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
Traceback (most recent call last):
File "run_basics.py", line 52, in <module>
write_obj(os.path.join(save_folder, name + '.obj'), vertices, colors, prn.triangles) #save 3d face(can open with meshlab)
File "/home/kyle/Documents/PRNet/utils/write.py", line 37, in write_obj
f.write(s)
TypeError: a bytes-like object is required, not 'str'
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
And that's mostly it! At this point your code base is compatible with both Python 2 and 3 simultaneously. Your testing will also...
Read more >Cheat Sheet: Writing Python 2-3 compatible code
This notebook shows you idioms for writing future-proof code that is compatible with both versions of Python: 2 and 3. It accompanies Ed...
Read more >How to detect if code is python 3 compatible - Stack Overflow
You can use Pycharm IDE for this. Just open the python files in the pycharm editor, it will show warnings ...
Read more >Python 3 Custom Check Migration - Datadog Docs
Use Datadog's Custom Check Compatibility tool to see whether your custom checks are compatible with Python 3 or need to be migrated.
Read more >Supporting Python 2 and 3 without 2to3 conversion
Python 2.7 has some small improvements on Python 3 compatibility, but it's likely that if you want to run the same code under...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Standard
2to3
write on everything works bar the bytes-str issue. Either dostr.encode('utf-8')
andb"my string"
or as @YadiraF suggests by removing byte writing mode ( more sensible ). I have this working under Python 3 environment.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
inTestImages/AFLW2000_results
to getTestImages/AFLW2000_results/AFLW2000
.