How to fix error after creating exe with Pyinsaller?

133 views Asked by At

After creating the file exe, the following error is displayed.

This problem may be related to the TCP/IP protocol.

I don't quite understand what the mistake is.

Traceback (most recent call last):
  File "list_queue.py", line 56, in <module>
  File "list_queue.py", line 17, in lenth_queue
  File "pymqi\__init__.py", line 3024, in connect
  File "pymqi\__init__.py", line 1649, in connect_tcp_client
  File "pymqi\__init__.py", line 1624, in connect_with_options
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2012: FAILED: MQRC_ENVIRONMENT_ERROR

Although everything works in PyCharm, all the data I enter works and the script works fine. MyCode:

def lenth_queue():
    
    dict_queue = collections.defaultdict(dict)
    queue_manager = input('Enter the name of the queue manager: ')
    channel = input('Enter the name of the communication channel: ')
    host = input('Enter a name for the IP address of the queue manager: ')
    port = input('Enter the name of the queue manager port: ')
    conn_info = '%s(%s)' % (host, port)
    queue_type = pymqi.CMQC.MQQT_LOCAL
    qmgr = pymqi.connect(queue_manager, channel, conn_info)
    c = 0
    try:
        prefix = '*'
        pcf = pymqi.PCFExecute(qmgr,response_wait_interval=600000)
        attrs = []  # typeList[pymqi.MQOpts]
        attrs.append(pymqi.CFST(Parameter=pymqi.CMQC.MQCA_Q_NAME,
                                    String=pymqi.ensure_bytes(prefix)))
        attrs.append(pymqi.CFIN(Parameter=pymqi.CMQC.MQIA_Q_TYPE,
                                    Value=queue_type))
        attrs.append(pymqi.CFIL(Parameter=pymqi.CMQCFC.MQIACF_Q_ATTRS,
                                    Values=[pymqi.CMQC.MQIA_CURRENT_Q_DEPTH]))

        object_filters = []
        object_filters.append(
                    pymqi.CFIF(Parameter=pymqi.CMQC.MQIA_CURRENT_Q_DEPTH,
                               Operator=pymqi.CMQCFC.MQCFOP_GREATER,
                               FilterValue=0))

        response = pcf.MQCMD_INQUIRE_Q(attrs, object_filters)

        for queue_info in response:
            queue_name = queue_info[pymqi.CMQC.MQCA_Q_NAME]
            queue_depth = queue_info[pymqi.CMQC.MQIA_CURRENT_Q_DEPTH]
            dict_queue[queue_name.strip().decode()] = queue_depth
            c += 1
        writer_queue('Queue_lenth',dict_queue)
        return 'File written successfully'
    except pymqi.MQMIError as e:
        return 'Failed to connect'
        


def writer_queue(name,dict_q):
        txt = io.open(name + ".txt", "w", encoding="utf-8")
        for key in dict_q:
            txt.write('{}: {} message(s)'.format(key, dict_q[key]) + '\n')
        txt.close()

print(lenth_queue())
input('Press ENTER to exit') 
0

There are 0 answers