Js2Py
Js2Py copied to clipboard
ReferenceError: DataView is not defined
Hello @PiotrDabkowski I tried with this js code but it's causing error.
// JavaScript
BinBuffer.allocate = function (uiLength) {
uiLength = self.position + uiLength;
if (self.buf != null && self.buf.length > uiLength) {
return
}
var temp = new ArrayBuffer(Math.max(256, uiLength * 2));
if (self.buf != null) {
new Uint8Array(temp).set(new Uint8Array(self.buf));
self.buf = undefined
}
self.buf = temp;
self.vew = undefined;
self.vew = new DataView(self.buf)
};
// error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1203, in __call__
return to_python(parent._obj.callprop(meth, *args))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 996, in callprop
return cand.call(self, args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1464, in call
return Js(self.code(*args))
File "<string>", line 95, in PyJs_anonymous_9_
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1153, in get
return self.prototype.get(prop, throw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1153, in get
return self.prototype.get(prop, throw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1153, in get
return self.prototype.get(prop, throw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\js2py\base.py", line 1158, in get
raise MakeError('ReferenceError', '%s is not defined' % prop)
js2py.internals.simplex.JsException: ReferenceError: DataView is not defined