0

I am currently working on a PyQt5 project and following along with Martin Fitzpatrick's "Create GUI Applications with PyQt5", and I have encountered an error which seems a little confusing to me.

I have used Qt Creator (v. 4.13) to create .ui and .qrc files to be used for the project, which do not seem to have any errors in them (I have not modified them at all). I am able to compile the .ui files into .py class files without any issues using the following command (in the command line):

python -m PyQt5.uic.pyuic -x [filename].ui -o [FileName].py 

This runs without any issue, but when trying to compile .qrc files into .py resource files I get a "No code object available for PyQt5.pyrcc" when using a similar command:

python -m PyQt5.pyrcc -x resources.qrc -o resources.py

I am using a virtual environment created with Anaconda, to avoid messing around with the PATH variable and all the headaches that creates, and this environment is active when I run the command. It has no problem finding the PyQt5 package (importing PyQt5.uic.pyuic and PyQt5.pyrcc also work without any issue in the python terminal).

I have looked online for an answer, including here, but was not able to find anything that would help me understand precisely what is the source of this error, and if any solution exists that would not require altering the PATH variable (since that does not seem to be the issue from my understanding). Any help would be greatly appreciated. Thanks!

adouv
  • 38
  • 5
  • What version of PyQt5 did you install and how? – musicamante Oct 09 '20 at 11:26
  • remove `-x` option in `python -m PyQt5.pyrcc -x resources.qrc -o resources.py ` – eyllanesc Oct 09 '20 at 11:43
  • I've already tried removing the -x flag in the command, but that does not change the error. I installed PyQt5 version 5.9.7 using the usual conda install command, making sure to install it in the appropriate environment. I have tried to look for other answers regarding this issue, but I cannot seem to find anything that explains why this particular command yields this error. At the same time, I did manage to find a workaround using the command line directly (pyrcc5 -o filename.py filename.rc), even though this approach does not work when running pyuic5 from the command line. Strange, indeed... – adouv Oct 11 '20 at 13:25

0 Answers0