JsException: ReferenceError: Promise is not defined
rodolfogf-dev opened this issue · 1 comments
rodolfogf-dev commented
Im using stacktrace lib to do some conversions of stack frame erros that happens in javascript, to understand better and convert in a more human readable way.
However, this lib uses promises in some functions, and when I call then through js2py I get the error:
JsException: ReferenceError: Promise is not defined
Ex in python:
import js2py
StackGPS = js2py.require('stacktrace-gps');
Promise = js2py.require('promise');
StackGPS({... a bunch of object information }).pinpoint() <- this function returns a promise
And after executing the process i get the error related above. Im missing something? Does js2py supports promises on the actual version??
rodolfogf-dev commented
stacktrace from error
C:\Python\lib\site-packages\js2py\base.py in __call__(self, *args)
1201 if '_prop_of' in self.__dict__:
1202 parent, meth = self.__dict__['_prop_of']
-> 1203 return to_python(parent._obj.callprop(meth, *args))
1204 return to_python(self._obj(*args))
1205
C:\Python\lib\site-packages\js2py\base.py in callprop(self, prop, *args)
994 '%s is not a function (tried calling property %s of %s)' % (
995 cand.typeof(), repr(prop), repr(self.Class)))
--> 996 return cand.call(self, args)
997
998 def to_python(self):
C:\Python\lib\site-packages\js2py\base.py in call(self, this, args)
1462 args += this, arguments #append extra params to the arg list
1463 try:
-> 1464 return Js(self.code(*args))
1465 except NotImplementedError:
1466 raise
<string> in PyJs_InlineNonPyName_83_(stackframe, this, arguments, var)
C:\Python\lib\site-packages\js2py\base.py in get(self, prop, throw)
1151 cand = self.own.get(prop)
1152 if cand is None:
-> 1153 return self.prototype.get(prop, throw)
1154 return cand
1155 # slow, global scope
C:\Python\lib\site-packages\js2py\base.py in get(self, prop, throw)
1151 cand = self.own.get(prop)
1152 if cand is None:
-> 1153 return self.prototype.get(prop, throw)
1154 return cand
1155 # slow, global scope
C:\Python\lib\site-packages\js2py\base.py in get(self, prop, throw)
1151 cand = self.own.get(prop)
1152 if cand is None:
-> 1153 return self.prototype.get(prop, throw)
1154 return cand
1155 # slow, global scope
C:\Python\lib\site-packages\js2py\base.py in get(self, prop, throw)
1151 cand = self.own.get(prop)
1152 if cand is None:
-> 1153 return self.prototype.get(prop, throw)
1154 return cand
1155 # slow, global scope
C:\Python\lib\site-packages\js2py\base.py in get(self, prop, throw)
1156 if prop not in self.own:
1157 if throw:
-> 1158 raise MakeError('ReferenceError', '%s is not defined' % prop)
1159 return undefined
1160 return PyJs.get(self, prop)
JsException: ReferenceError: Promise is not defined