報錯代碼:
import time
from hashlib import md5
import execjs
sid="gom17h0kmgrtiba1mk9m6nt3mg"
data={"test":"abc"}
with open ("test.js", encoding='utf8') as f:
js_data = f.read().encode("gbk", 'ignore').decode("gbk", "ignore")
ctx = execjs.compile(js_data)
code="pgenc('{}','{}','{}','{}')".format(sid,'',data,md5)
result=ctx.eval(code)
print(result)
報錯內容:
execjs._exceptions.ProgramError: TypeError: Cannot read property 'extend' of undefined