Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import fontkit lib #301

Open
MikeUdin opened this issue Feb 16, 2023 · 0 comments
Open

Can't import fontkit lib #301

MikeUdin opened this issue Feb 16, 2023 · 0 comments

Comments

@MikeUdin
Copy link

Hello! This code gives me an error.

import js2py

def main():

    context = js2py.EvalJs(enable_require=True)
    context.execute("var fontkit = require('fontkit');")

if __name__ == '__main__':
    main()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/evaljs.py", line 199, in execute
    exec (compiled, self._context)
  File "<EvalJS snippet>", line 2, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/evaljs.py", line 162, in _js_require_impl
    return require(to_python(npm_module_name), context=self._context)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/node_import.py", line 166, in require
    exec(py_code, context)
  File "<string>", line 32269, in <module>
  File "<string>", line 32268, in PyJs_LONG_2046_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32259, in PyJsHoisted_r_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32250, in PyJsHoisted_o_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 232, in PyJs_anonymous_7_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32248, in PyJs_anonymous_2045_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32250, in PyJsHoisted_o_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 27692, in PyJs_anonymous_1144_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 27690, in PyJs_anonymous_1145_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 16457, in PyJs_anonymous_1146_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32248, in PyJs_anonymous_2045_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 949, in __call__
    return self.call(self.GlobalObject, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 32250, in PyJsHoisted_o_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 996, in callprop
    return cand.call(self, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/prototypes/jsfunction.py", line 27, in call
    return this.call(obj, args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1464, in call
    return Js(self.code(*args))
  File "<string>", line 28816, in PyJs_anonymous_1807_
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1153, in get
    return self.prototype.get(prop, throw)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/js2py/base.py", line 1158, in get
    raise MakeError('ReferenceError', '%s is not defined' % prop)
js2py.internals.simplex.JsException: ReferenceError: TextEncoder is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant