question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to import ws

See original GitHub issue

Hello, I’m trying to import the ws module by doing this : js2py.require('ws') and it stops while printing:

La syntaxe du nom de fichier, de r�pertoire ou de volume est incorrecte.
Traceback (most recent call last):
  File "F:\Python\OWOP.py\main.py", line 3, in <module>
    js2py.require('ws')
  File "C:\Users\romeo\AppData\Local\Programs\Python\Python39\lib\site-packages\js2py\node_import.py", line 154, in require
    py_code = _get_and_translate_npm_module(module_name, include_polyfill=include_polyfill, update=update,
  File "C:\Users\romeo\AppData\Local\Programs\Python\Python39\lib\site-packages\js2py\node_import.py", line 95, in _get_and_translate_npm_module
    assert subprocess.call(
AssertionError: Could not install the required module: ws

Idk how to fix this

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Talal916commented, Oct 5, 2021

@vk765 I don’t think your issue is similar. Just run npm install numpy in your environment.

0reactions
vk765commented, Jun 20, 2021

II have a similar problem, but with another stacktrace:

Traceback (most recent call last):
  File "/Users/vkornieiev/aqa/tests/_helpers/websocket_js.py", line 4, in <module>
    js2py.require('ws')
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/node_import.py", line 166, in require
    exec(py_code, context)
  File "<string>", line 11266, in <module>
  File "<string>", line 11265, in PyJs_LONG_1055_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11256, in PyJsHoisted_r_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11246, in PyJsHoisted_o_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 54, in PyJs_anonymous_2_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11244, in PyJs_anonymous_1054_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11246, in PyJsHoisted_o_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 99, in PyJs_anonymous_3_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 97, in PyJs_anonymous_4_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 78, in PyJs_anonymous_5_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11244, in PyJs_anonymous_1054_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11246, in PyJsHoisted_o_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11118, in PyJs_anonymous_1050_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11244, in PyJs_anonymous_1054_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11246, in PyJsHoisted_o_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 9492, in PyJs_anonymous_884_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11244, in PyJs_anonymous_1054_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 11246, in PyJsHoisted_o_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 4553, in PyJs_anonymous_403_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 2006, in PyJs_anonymous_157_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 4551, in PyJs_anonymous_405_
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Users/vkornieiev/aqa/venv/lib/python3.8/site-packages/js2py/constructors/jsuint16array.py", line 32, in Uint16Array
    temp = Js(numpy.array(array, dtype=numpy.uint16))
NameError: name 'numpy' is not defined
Read more comments on GitHub >

github_iconTop Results From Across the Web

ws - npm
A client WebSocket broadcasting to all connected WebSocket clients, including itself. import WebSocket, { WebSocketServer } from 'ws'; ...
Read more >
Can't import 'ws' - Chapter 16 - Big Nerd Ranch Forums
Hello, I get the following error while trying to import 'ws': $ node websockets-server.js
Read more >
import WebSocket from 'ws' in browser - Stack Overflow
The problem is, I'm using WebSocket in the code in this game git, but I imported the ws library because Node Js does...
Read more >
WebSockets and Node.js - testing WS and SockJS by building ...
In order to demonstrate how to set up WebSockets with Node and WS, ... If this is a requirement for your project, or...
Read more >
Examples — websocket-client 1.4.2 documentation
If you want to connect to a websocket without writing any code yourself, you can try out the Getting Started ... import websocket...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found