You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: comments.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,3 +72,35 @@ The Trezor chip is slow. It takes the Trezor (model 1) device about 75 seconds
72
72
-[x] make the image smaller on main window
73
73
-[x] more Testing
74
74
-[ ] get help with getting the word out, anyone wants to spread the word on Twitter, Reddit, with Trezor, Facebook, etc.?
75
+
76
+
# Migrating to Python3
77
+
78
+
Doing only Python 2.7 or only 3.4 is okay, but making both work on the same code base is cumbersome.
79
+
The combination would be Py2.7 | Py3.4 + PyQt4.11.
80
+
81
+
* Basic description of the problem is [here](https://docs.python.org/3/howto/pyporting.html) with some pointers as how to start.
82
+
*[2to3](https://docs.python.org/3/library/2to3.html) has been done. It was trivial. Only a few lines of code changed.
83
+
*[modernize](https://python-modernize.readthedocs.io/en/latest/) has been done. Again, it was just suggesting a few new lines related to the `range` operator.
84
+
*[futurize](http://python-future.org/automatic_conversion.html) was also done. It suggested only a few `import` lines. The 3 lines were added to all .py files.
85
+
```
86
+
from __future__ import absolute_import
87
+
from __future__ import division
88
+
from __future__ import print_function
89
+
```
90
+
* Changes related to GUI are:
91
+
PyQt4.11 for Py3.4 does not have class QString. It expects unicode objects. Simple hacks like
92
+
the folowing are not likely to work.
93
+
```
94
+
try:
95
+
from PyQt4.QtCore import QString
96
+
except ImportError:
97
+
# we are using Python3 so QString is not defined
98
+
QString = type("")
99
+
```
100
+
* Since Py2.7 does not have bytes and handles everything as strings. A common layer would have to be introduced
101
+
that simulates bytes on Py2.7. Some good code starting points can be found at
0 commit comments