jasonrbriggs / stomp.py

“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
491 stars 167 forks source link

in adapter.ws.py, logging module should be imported from stomp #404

Closed iamsnj closed 1 year ago

iamsnj commented 1 year ago

Hello, I am using dev branch code. I am getting the below error while connecting to a WebSocket server (ws://localhost:8080/work/websocket). There is a logging module in stomp directory. Its name is matching with python's existing module, so there rises a conflict. To avoid this conflict, we must import like import stomp.logging as logging in adpater/ws.py module or we can rename stomp.logging module to something else such that it does not match any existing module. There can be more such cases.

Traceback (most recent call last): File "/home/sanjay/webs/lib/python3.10/site-packages/stomp/adapter/ws.py", line 338, in attempt_connection self.socket = websocket.create_connection( File "/home/sanjay/webs/lib/python3.10/site-packages/websocket/_core.py", line 605, in create_connection websock.connect(url, options) File "/home/sanjay/webs/lib/python3.10/site-packages/websocket/_core.py", line 246, in connect self.sock, addrs = connect(url, self.sock_opt, proxy_info(options), File "/home/sanjay/webs/lib/python3.10/site-packages/websocket/_http.py", line 130, in connect sock = _open_socket(addrinfo_list, options.sockopt, options.timeout) File "/home/sanjay/webs/lib/python3.10/site-packages/websocket/_http.py", line 205, in _open_socket raise err File "/home/sanjay/webs/lib/python3.10/site-packages/websocket/_http.py", line 185, in _open_socket sock.connect(address) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/sanjay/websocket-client/ws_client.py", line 28, in conn.connect(wait=True, headers=header, with_connect_command=True) File "/home/sanjay/webs/lib/python3.10/site-packages/stomp/connect.py", line 198, in connect self.transport.start() File "/home/sanjay/webs/lib/python3.10/site-packages/stomp/transport.py", line 108, in start self.attempt_connection() File "/home/sanjay/webs/lib/python3.10/site-packages/stomp/adapter/ws.py", line 349, in attempt_connection str(exc), exc_info=logging.verbose) AttributeError: module 'logging' has no attribute 'verbose'

jasonrbriggs commented 1 year ago

Fixed. Thanks for the report.