qmgr not recognized

Asked by ccremers

( total pymqi noob here )

I am trying to write some code that will allow us to monitor queue depth and return messages. I downloaded and installed pymqi and it seemed to go well, but when I try using it, I get 2058 errors.

Using runmqsc, the queue manager is there :
-bash-3.00$ runmqsc MTASOEAST
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager MTASOEAST.

end
     1 : end
No MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.

But when I try to run the program that talks to the queue manager, I get 2058 ( aka you can't spell the queue manager name )

-bash-3.00$ python qd.py
MQI Error. Comp: 2, Reason 2058: FAILED: MQRC_Q_MGR_NAME_ERROR

Source : there's a lot more : this is just pared down to the minimum :

from pymqi import *
import sys, os
from optparse import OptionParser

usage='Usage: %s [options] QMGRNAME QNAME'
def main(argv=None):
    if argv is None:
      argv = sys.argv
    try:

      #open queue manager
      qmgr = QueueManager('MTASOEAST')

    except MQException, err:
      print '[ERROR]',err.errorCodes[err.msg]
      print usage % (sys.argv[0],)
      return err.code
    except MQMIError,err:
      if err.reason==2033:
        #no messages
        print 'No messages.'
      else:
        print err
        return err.reason

#MQException class that holds application specific error codes
#and error messages
class MQException(Exception):
  errorCodes={'1': 'QMGRNAME, QNAME or MESSAGE missing.',
              '2': 'Too many arguments.',
              '3': 'File does not exist.',
              '4': 'QMGRNAME or QNAME missing.',
              '5': 'Index error. Not so many messages in queue.',
              }
  code=0
  def __init__(self, code):
    self.code=code
    self.msg = str(code)

if __name__ == "__main__":
    sys.exit(main())

Any ideas ?

Thanks,

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
ccremers
Solved:
Last query:
Last reply:
Revision history for this message
Dariusz Suchojad (dsuch) said :
#1

Hi there,

> I am trying to write some code that will allow us to monitor
> queue depth and return messages. I downloaded and installed pymqi
> and it seemed to go well, but when I try using it, I get 2058 errors.

because you're connecting in the MQ binding mode (qmgr = QueueManager('MTASOEAST')), my bet is that you're using PyMQI built in the client mode instead of the bindings one. Which file have you downloaded and how did you install it? Were you compiling it yourself or is it one of the precompiled binaries?

Revision history for this message
ccremers (ccremers) said :
#2

I downloaded the source from http://packages.python.org/pymqi I tried both client install and server install and got the same results. On Solaris :

python setup.py build client
python setup.py install

and

python setup.py build server
python setup.py install

Both gave results along the lines of :
Building PyMQI client 32bits
running install
running build
running build_py
running build_ext
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/bin/mqmess.py to 755
changing mode of /usr/bin/browse.py to 755
changing mode of /usr/bin/inq.py to 755

Revision history for this message
Dariusz Suchojad (dsuch) said :
#3

> Both gave results along the lines of :
> Building PyMQI client 32bits

Heh yeah, but that's the crucial part - whether it's currently built in client or server mode.

What's the output of doing

>>> import pymqi
>>> pymqi.__mqbuild__

in Python shell?

Revision history for this message
ccremers (ccremers) said :
#4

It turns out that if I switch from "build client" to "build server", I need to blow off the build directory inbetween ... Thanks to Dariusz Suchojad for his suggestion of running "pymqi.__mqbuild__" after each build. rm -r build, followed by "build server", and my code suddenly worked as it should.

Revision history for this message
Dariusz Suchojad (dsuch) said :
#5

Glad you got it working now, be sure to drop by if you need any help! :-)

And because you said yourself you were new to PyMQI be also sure to check the examples out http://packages.python.org/pymqi/examples.html and let me know if there's anything else you'd like me to add over there.

Cheers!