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

import 的时候报错,找不到'mr_eval_context' #38

Open
GuardHa opened this issue Aug 27, 2024 · 3 comments
Open

import 的时候报错,找不到'mr_eval_context' #38

GuardHa opened this issue Aug 27, 2024 · 3 comments

Comments

@GuardHa
Copy link

GuardHa commented Aug 27, 2024

{
"name": "AttributeError",
"message": "function 'mr_eval_context' not found",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[12], line 1
----> 1 import qstock as qs

File ~\AppData\Roaming\Python\Python312\site-packages\qstock\init.py:9
3 '''
4 @author :Jinyi Zhang
5 @Date :2022/9/29 20:20
6 '''
7 #数据模块
8 #股票、债券、期货、基金等交易行情数据
----> 9 from qstock.data.trade import *
11 #新闻数据
12 from qstock.data.news import *

File ~\AppData\Roaming\Python\Python312\site-packages\qstock\data\trade.py:21
18 from jsonpath import jsonpath
19 from datetime import datetime, timedelta
---> 21 from qstock.data.util import (request_header, session, market_num_dict,
22 get_code_id, trans_num, trade_detail_dict, )
24 signal.signal(signal.SIGINT, multitasking.killall)
26 #获取某市场所有股票/债券/基金代码

File ~\AppData\Roaming\Python\Python312\site-packages\qstock\data\util.py:150
120 js_str = """
121 function mcode(input) {
122 var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "=";
(...)
147 }
148 """
149 random_time_str = str(int(time.time()))
--> 150 js_code = py_mini_racer.MiniRacer()
151 js_code.eval(js_str)
152 mcode = js_code.call("mcode", random_time_str)

File ~\AppData\Roaming\Python\Python312\site-packages\py_mini_racer\py_mini_racer.py:178, in MiniRacer.init(self)
176 def init(self):
177 if self.class.ext is None:
--> 178 self.class.ext = _build_ext_handle()
180 self.ctx = self.ext.mr_init_context(" ".join(self.v8_flags).encode("utf-8"))
181 self.lock = threading.Lock()

File ~\AppData\Roaming\Python\Python312\site-packages\py_mini_racer\py_mini_racer.py:132, in _build_ext_handle()
129 _ext_handle.mr_init_context.argtypes = [ctypes.c_char_p]
130 _ext_handle.mr_init_context.restype = ctypes.c_void_p
--> 132 _ext_handle.mr_eval_context.argtypes = [
133 ctypes.c_void_p,
134 ctypes.c_char_p,
135 ctypes.c_int,
136 ctypes.c_ulong,
137 ctypes.c_size_t]
138 _ext_handle.mr_eval_context.restype = ctypes.POINTER(MiniRacerValueStruct)
140 _ext_handle.mr_free_value.argtypes = [ctypes.c_void_p, ctypes.c_void_p]

File c:\Program Files\Python312\Lib\ctypes\init.py:392, in CDLL.getattr(self, name)
390 if name.startswith('') and name.endswith(''):
391 raise AttributeError(name)
--> 392 func = self.getitem(name)
393 setattr(self, name, func)
394 return func

File c:\Program Files\Python312\Lib\ctypes\init.py:397, in CDLL.getitem(self, name_or_ordinal)
396 def getitem(self, name_or_ordinal):
--> 397 func = self._FuncPtr((name_or_ordinal, self))
398 if not isinstance(name_or_ordinal, int):
399 func.name = name_or_ordinal

AttributeError: function 'mr_eval_context' not found"
}

@liu-jin
Copy link

liu-jin commented Sep 5, 2024

好像是因为用了一个比较老的py_mini_racer,我是mac m芯片,跑不了,把依赖升级到mini-racer 0.12.4 ,就可以跑了

@allon2
Copy link

allon2 commented Oct 11, 2024

py_mini_racer 怎么升级到mini-racer 0.12.4 ,本地升级后,发现还需要修改qstock的一些代码

@xiongzaizhuzhu
Copy link

我也遇到了同样的问题,求解答!

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

4 participants