Today I had a look at running Allzpark without a console window on Windows.
Next I had a look at removing that console window from appearing alongside Allzpark. Normally, when running Qt applications from Python, you get the associated Python console window. That's why, on Windows, Python ships with another executable, the pythonw.exe
for "windowed" applications. The crux is, those don't get an associated sys.stdout
which not only makes any standard output streams invisible and thus impossible to use for debugging, it makes some of the assumptions we've made in the code invalid.
2 hours later
This wasn't as easy as it sounds, primarily because pythonw
doesn't provide sys.std*
handles, and secondarily because Rez was very keen on referencing these internally, via the second-hand reference sys.__stdin__
.
It's somewhat in place now, but not perfect. Rez is also keen on calling subprocess
for a great many things, and some of them assume a shell (especially those with Popen(shell=True)
), which causes a window to appear and instantly disappear when you least expect it. Not harmful, it seems, but not a very pleasant user experience either.
Nonetheless, here's how to use it (on Windows-only, Linux doesn't need this solution)
pythonw -m allzpark
Today I've had several people walk through the current guide looking for trouble, and we've found plenty!
"Some text" | Out-File my_file.txt
Did you know this actually produces a file with unicode encoding? Why is that important? Well if you try and open this file in a Unicode-able text editor, everything will appear fine. However, if you try writing a package.py
in Unicode, then Rez will throw its hands up. This is likely a bug in Rez, rather than an issue with Unicode, but the problem was actually debugging this as the error was not obvious..
TypeError: expected str, bytes or os.PathLike object, not NoneType
Some PyPI packages won't install if they have "markers" in them; i.e. conditional requirements. Some examples include urllib3
and the requests
library, but also Allzpark.
In order to make installation more consistent between both Python 2 and 3 for Allzpark, I've added a conditional requirement for PySide on Python 2 and PySide2 on Python 3.
setup(
# ...
install_requires=[
"bleeding-rez>=2.38.2",
"allzparkdemo>=1",
# Specifically for Python 2..
"PySide; python_version<'3'",
# ..and likewise for Python 3
"PySide2; python_version>'3'",
],
)
So now when you call pip install allzpark
from Python 2, you'll also get PySide, but then PySide2 from Python 3. This reduced the quickstart from 3,300 to 2,100 characters. Win!
Last day at Studio Anima! Will be writing up a final summary of where we've been and ideas on where to go next, and tackle various minor requests that appear throughout the day.