Open crxcv opened 6 years ago
Is the websocket module listed in modules? With websockets enabled in menuconfig:
>>> help('modules')
__main__ io select upip_utarfile
_thread json socket upysh
ak8963 logging ssd1306 urandom
array machine ssl ure
binascii math struct urequests
btree microWebSocket sys uselect
builtins microWebSrv time usocket
cmath microWebTemplate tpcalib ussl
collections micropython ubinascii ustruct
display mpu6500 ucollections utime
errno mpu9250 uctypes utimeq
framebuf network uerrno uzlib
freesans20 os uhashlib **websocket**
functools ota uheapq writer
gc pye uio ymodem
gsm random ujson zlib
hashlib re uos
heapq requests upip
Plus any modules on the filesystem
>>> import websocket
>>> dir(websocket)
['__class__', '__name__', 'websocket']
>>>
It seems that the microWebSrv.py
never actually directly uses websocket
at all. Is it even necessary to import it? It gets imported again from microWebSocket.py
and the import of that into the main server is wrapped in a try ... except ...
(which is silent and ignores all exceptions 😦 ). Maybe the right thing to do is to remove the line that imports websocket
since it looks like the rest of the server should work fine even if websocket support is configured to be off.
@nickovs You are right, websockets module is not used by microWebSrw/microWebSocket and the import can be removed. I don't remember why the import was placed in those files. I'll remove it in the next update.
In the latest commit the unneeded imports are removed.
tried with websocket enabled and disabled in menuconfig. same result.
I don't use websockets, so i downloaded the file microWebSocket.py, renamed it to websocket.py and uploaded it to the esp. --> no more error