Open booox opened 1 year ago
Boost. Similar issue here.
Js2Py seems to be missing support for this format, this hacky patch to node_import.py will get it working:
92c92,96
< pkg_name = module_name.partition('/')[0]
---
> #pkg_name = module_name.partition('/')[0]
> if module_name.startswith("@"):
> pkg_name = ''.join(module_name.partition('/')[:3])
> else:
> pkg_name = module_name.partition('/')[0]
153c157,162
< module_name, maybe_version = (module_name+"@@@").split('@')[:2]
---
> #module_name, maybe_version = (module_name+"@@@").split('@')[:2]
> if module_name.startswith("@"):
> module_name, maybe_version = (module_name+"@@@").split('@')[1:3]
> module_name = "@" + module_name
> else:
> module_name, maybe_version = (module_name+"@@@").split('@')[:2]
Your module still doesn't load though, generates an Unexpected token error in the Babel parser.
Hi, I'm encountering trouble when trying to require a module with a
@
envs
OS: Windows 10 Python3.11 js2py installed with
pip install js2py
Tries
Try docs examples, it's OK
Try require
@tryfabric/martian
Try replace node_import.py with @hellmolt 's code
code link
And replaced
pkg_name
withmodule_name
in line 169-173AssertionError:
How to solve this?
Any help will be appriciated.