--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c8064e40-47d7-4213-a39e-0f4e010f610d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I don’t have experience with PyCharm either, but you’ll get errors like these if required binaries can’t be found.
If you got the official Riverbank distribution, then it’ll add the PyQt4 directory to your PATH. It’s possible that PyCharm modifies this which would cause an error like this.
You could very this if you add this before using the PyQt libraries (e.g. before instantiating QApplication
).
import os
import PyQt4
os.environ["PATH"] += ";" + os.path.dirname(PyQt4.__file__)
That’ll expose the binaries again, at which point you should be able to use PyQt4 regardless of alterations to your PATH.
Another possibility is if PyCharm chooses to use another executable for Python.
PyQt needs a qt.conf
file next to wherever the executable is, so if it’s different its likely it won’t be there.
You can verify this by printing this in debugging mode.
import os
import sys
dirname = os.path.dirname(sys.executable)
qtconf = os.path.join(dirname, "qt.conf")
print "qt.conf OK" if os.path.isfile(qtconf) else "qt.conf MISSING"
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8cb1a2f7-9a29-4aa6-88dd-826e7e884ad1%40googlegroups.com.--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
Does PyCharm try and download packages automatically from Pypi? It's not going to work with PyQt if it tries. I assumed the fix only involves updating the project settings to find PyQt on the PYTHONPATH. If it is anything like the pydev from Eclipse, that should be all it cares about. Copying libs around would just be a hack instead of adjusting paths in the env.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkXdj-7CS5rf%2BE%3D41uYJZzo550j0ysiMWwsShavZCsXfzA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3c4_KXmNv6t4h7oKJ-w3hkJLoDvPk2nvxzAOBUV9dgHA%40mail.gmail.com.
I have appended the PYTHONPATH using sys.path.append and have added the qtconf file as per Marcus’ answer
Could you take me through what you did exactly?
and also: sys.path.append(‘C:\Python27\lib\site-packages\pyqt4’)
I think you may have misunderstood me here, this is not the same as:
os.environ["PATH"] += ";" + "C:\\Python27\\lib\\site-packages\\pyqt4"
Adding to sys.path
is the equivalent of adding to your PYTHONPATH
and has nothing to do with the PyQt binaries, which will look at your PATH
.
What did you do with the qt.conf
file? The contents of this file is also very important and relative to where you put it.
import sys
import os
import PyQt4
dirname = os.path.dirname(sys.executable)
qtconf = os.path.join(dirname, "qt.conf")
os.environ["PATH"] += ";" + os.path.dirname(PyQt4.__file__)
print os.environ["PATH"]
print "qt.conf OK", qtconf if os.path.isfile(qtconf) else "qt.conf MISSING"
from PyQt4 import QtGui
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOD-D43ZcC_qqCkepXs7MWw9RC8h-r2JkBbn0th255GyUQ%40mail.gmail.com.
Have a look within the qt.conf
file, it’s a simple ConfigFile format (i.e. a .ini
file).
It should point to where the Qt binaries are; typically in your PyQt4 directory. If the paths are relative, and you move the file, then the resulting absolute paths will be bad. You can safely put in the absolute path to the binaries, just make sure to use forward slashes (/) and not backslashes (\).
For example:
[Paths]
Prefix = C:/Python27/Lib/site-packages/PyQt4
Binaries = C:/Python27/Lib/site-packages/PyQt4
Did you find out whether it were using a different executable? If it’s using the same as before, then this is likely not the problem.
You can print the executable using sys.executable
. It should tell you which one is currently being used.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA_he0P-qQ40tqNkCSwCoy%3D_AJEdxs-hF0y6s66GAgCqQ%40mail.gmail.com.
In that case my advice is no good, sorry. I can't say for sure what's going on without know more about what PyCharm does in debug mode.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODT-kQf_q6jz5PVeuFX4mRTPj%3DpdiravJXzR99CV1dLMQ%40mail.gmail.com.
from Qt import QtCore, QtGui, QtWidgets
if False:
from PyQt4 import QtGui, QtCore
QtWidgets = QtGui
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/12c95a8e-8232-4515-a52f-f39e12e873ca%40googlegroups.com.
TomThanks,Hi Ben,Sorry it doesn't work for you. I only changed this option, then it's working. BTW, I am using the latest Pycharm version 2017.1.5, not sure if it's related to version.
On Fri, Jul 14, 2017 at 1:58 AM, Benjam901 <benandr...@gmail.com> wrote:
Hello Tom,I tried your approach and unfortunately it was no dice for me. The only way I have been able to get this to work is by using a solution posted above. Did you change any other settings in PyCharm?from Qt import QtCore, QtGui, QtWidgets
if False:
from PyQt4 import QtGui, QtCore
QtWidgets = QtGui- Ben
On Thursday, 13 July 2017 21:42:25 UTC+2, Fengyu Yan wrote:Hi All,
I had this issue and figured it out it can be resolved easily, don't need to re-install everything. So put solution here in case anyone has similar issue.
Open setting window and select Python Debugger, then uncheck option "PyQt compatible".
Thanks,
Tom
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/12c95a8e-8232-4515-a52f-f39e12e873ca%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/uVfecbv9XEM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAOawZ2TJ6GmND-gBJXpSS96_41MNYivn-uym6pER22Kf7d%2BdwQ%40mail.gmail.com.