This thread will be renamed to include the word "installation" for future searches.
Hi ,
I have a simple code as shown below :
-
import pymqi
-
qmgr = pymqi.QueueManager()
-
putQ = pymqi.Queue(qmgr, 'TESTQ1')
-
putQ.put('Hello from Python!')
When i run this piece of code i get an error as :
File "C:\Python24\pymqi-0.5d\pymqi-0.5d\testmq.py", line 1, in ?
import pymqi
File "C:\Python24\pymqi-0.5d\pymqi-0.5d\pymqi.py", line 82, in ?
import pymqe, CMQC, CMQCFC
ImportError: No module named pymqe
Kindly advise !
Thanks & Regards,
VC
This sounds like some kind of installation problem. Python doesn't automatically search directories for modules. It does search all directories listed in sys.path. and the current working directory. There are several ways to add a directory to sys.path. If, for example, pymqe, CMQC, and CMQCFC are in C:\Python24\pymqi-0.5d\ instead of C:\Python24\pymqi-0.5d\pymqi-0.5d\, a simple trick that I use is: put these lines
-
import sys
-
sys.path.append(r"C:\Python24\pymqi-0.5d")
before
import pymqi
in your module.
Some alternatives include:
add or edit the environment varialbe PYTHONPATH to include the desired directory
Move this package to C:\Python24\Lib\site-packages (a more proper place) and create a .pth file with the directory name in it.
Actually the .pth file will probably work if you put it in C:\Python24\pymqi-0.5d\pymqi-0.5d\.
Of course, none of this is any help if you simply don't have pymqe, CMQC, or CMQCFC modules/files.