Unicode String and Integer Division related crashes (python2 vs. python3)
See original GitHub issueMy attempted command is python3 ideepcolor.py --cpu_mode
All dependencies seem to have installed correctly.
I am obtaining the following crash on Intel i3 w/ Debian 9 Codename Stretch:
b'test_imgs/mortar_pestle.jpg'
Traceback (most recent call last):
File "ideepcolor.py", line 60, in <module>
window = gui_design.GUIDesign(color_model=colorModel, dist_model=distModel, img_file=args.image_file, load_size=args.load_size, win_size=args.win_size)
File "/home/bb/ideepcolor/ui/gui_design.py", line 112, in __init__
self.drawWidget.init_result(img_file)
File "/home/bb/ideepcolor/ui/gui_draw.py", line 54, in init_result
self.read_image(image_file.encode('utf-8')) # read an image
File "/home/bb/ideepcolor/ui/gui_draw.py", line 79, in read_image
im_bgr = cv2.imread(image_file)
TypeError: bad argument type for built-in operation
Thanks for your help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Python 3 strange division - Stack Overflow
Python 3 is not "rounding big integers". What it does is that it will return a float after division. Hence, in Python 2:...
Read more >The Key Differences Between Python 2 and Python 3
Unicode Strings: Python 3 stores strings as Unicode by default, whereas Python 2 requires you to mark a string with a “u” if...
Read more >Python 2 vs. Python 3 — Important Differences Every Hacker ...
Python 3 also handles the division of integers differently. In version 2, dividing two integers would yield an integer as a result:
Read more >The key differences between Python 2.7.x and Python 3.x with ...
Unicode. Python 2 has ASCII str() types, separate unicode() , but no byte type. Now, in Python 3, we finally have Unicode (utf-8)...
Read more >Differences with Python 2 - Dodona
In Python 3, it is automatically assumed that if you use division, ... The way Python 2 works is similar to what most...
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 FreeTop 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
Top GitHub Comments
I see https://github.com/junyanz/interactive-deep-colorization/blame/python3/ui/gui_draw.py Strings are already unicode in python3 whereas python2 is old-fashioned ASCII, requiring conversion. You may want a
python3
branch. https://github.com/Benitoite/interactive-deep-colorization/tree/python3 Perhaps a python2/python3 conditional is possible.I think sometimes people’s OS/distribution will allow either one or both pythons, sometimes because of package managers or a dependencies python hook locked to one version.
Thanks for the update. I fixed the integer division issue with the latest commit.