0

“ModuleNotFoundError: No module named 'my_toolkit'” 我可以成功运行脚本。我已经将模块 my_toolkit 添加到我的系统路径中。但是 kernprof.py 无法识别我的工具包。顺便说一下,我可以成功运行 memory_profile。Traceback 是这样的:

# -*- coding: utf-8 -*-
"""
Proj: ad_helper
Created on:   2020/6/28 10:26
@Author: RAMSEY
"""

from my_toolkit import interface_auth



# @retry(stop_max_attempt_number=3, wait_fixed=0.5)
# @public_function.run_time
@profile
def query_listing(seller_sku, request_url='http://rest.java.yibainetwork.com/log/yibaiListing/search', ) -> dict:
    java_requests = interface_auth.JavaInterface()
    params = {
        "sellerSku": seller_sku,
    }
    requests_data = java_requests.request_data(url=request_url, params=params)

    request_sku = {content['sellerSku']: content['sku'] for content in requests_data['data']['content']}
    return request_sku


if __name__ == '__main__':
    other_platform_skus = ['QSCM0W9T2F9L0M',
                           'QYCL0R0T6F5S8C',
                           'QACV0C5O8G6X3O-04',]
    other_platform_skus_str = ','.join(other_platform_skus)
    erpskus = query_listing(other_platform_skus_str)
    print(erpskus)
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\pycharmproject\venv\Scripts\kernprof.exe\__main__.py", line 9, in <module>
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\kernprof.py", line 226, in main
    execfile(script_file, ns, ns)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\kernprof.py", line 35, in execfile
    exec_(compile(f.read(), filename, 'exec'), globals, locals)
  File "java_interface/query_listing.py", line 26, in <module>
    from my_toolkit import public_function
ModuleNotFoundError: No module named 'my_toolkit'
4

0 回答 0