0

env: windows10-64, python3.8.8,

CALL relation is -->

relations

  1. in file jgtrade_api_func_def.py
    #!/usr/bin/env python
    #  coding:utf-8
    from ctypes import *
    
    jgtradeapi = windll.LoadLibrary('lib/td/JGTradeApi.dll')
  1. in file td_api.py
    # -*- coding:utf-8 -*-
    from jg_api.jgtrade_api import *
    ###
  • in main.py
    from jg_api.td_api import JGTradeApi
  • When I run td_api.py, it works well

  • When I run main.py, FileNotFoundError

    File "D:\work\WCJGClient\jg_api\jgtrade_api_func_def.py", line 14, in jgtradeapi = windll.LoadLibrary('lib/td/JGTradeApi.dll') File "D:\ProgramData\Anaconda3\lib\ctypes_init_.py", line 459, in LoadLibrary return self.dlltype(name) File "D:\ProgramData\Anaconda3\lib\ctypes_init.py", line 381, in init self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'D:\work\WCJGClient\lib\td\JGTradeApi.dll' (or one of its dependencies). Try using the full path with constructor syntax.

  • Then I change path as windll.LoadLibrary('jg_api/lib/td/JGTradeApi.dll'), the error changed

    File "D:\work\WCJGClient\jg_api\jgtrade_api_func_def.py", line 14, in jgtradeapi = windll.LoadLibrary('jg_api/lib/td/JGTradeApi.dll') File "D:\ProgramData\Anaconda3\lib\ctypes_init_.py", line 459, in LoadLibrary return self.dlltype(name) File "D:\ProgramData\Anaconda3\lib\ctypes_init.py", line 381, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 127] The specified procedure could not be found.

  • I also tried to use an absolute path, but reported the same error, Has anyone ever had such a problem?

1 Answer 1

1

OMG, I solved the problem!!!The reason is that the reference of DLL conflicts with pyside2!And when I change the import order, it works well enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.