[未解决]报错: execjs._exceptions.ProgramError: TypeError: Cannot read property 'extend' of undefined

时间:2022-07-25
本文章向大家介绍[未解决]报错: execjs._exceptions.ProgramError: TypeError: Cannot read property 'extend' of undefined,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

报错代码:

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