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

Python: AttributeError: Tolk #23

Open
chigkim opened this issue Feb 11, 2024 · 2 comments
Open

Python: AttributeError: Tolk #23

chigkim opened this issue Feb 11, 2024 · 2 comments

Comments

@chigkim
Copy link

chigkim commented Feb 11, 2024

I'm having a problem running the python example.
It seems I'm missing something very basic, but I'd appreciate if someone could help.

I copied src\python\Tolk.py to examples\python.
Then I copied the following dlls to examples\python.
dolapi32.dll
nvdaControllerClient32.dll
nvdaControllerClient64.dll
SAAPI32.dll
SAAPI64.dll

I ran build.bat, and got no output no error.
When I run python ConsoleApp.py, I get the error below.

Traceback (most recent call last):
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 450, in __getattr__
    dll = self._dlltype(name)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'Tolk' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\code\tolk\examples\python\ConsoleApp.py", line 16, in <module>
    import Tolk
  File "D:\code\tolk\examples\python\Tolk.py", line 11, in <module>
    _tolk = cdll.Tolk
            ^^^^^^^^^
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 452, in __getattr__
    raise AttributeError(name)
AttributeError: Tolk

Thanks so much!

@beqabeqa473
Copy link

beqabeqa473 commented Feb 11, 2024 via email

@chigkim
Copy link
Author

chigkim commented Feb 12, 2024

Thanks for your reply, but still I can't get it to run.
I added the following to ConsoleApp.py.

import os
os.add_dll_directory(os.path.dirname(__file__))

However, I get the error below.

D:\code\tolk\examples\python>python ConsoleApp.py
Traceback (most recent call last):
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 450, in __getattr__
    dll = self._dlltype(name)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'Tolk' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\code\tolk\examples\python\ConsoleApp.py", line 18, in <module>
    import Tolk
  File "D:\code\tolk\examples\python\Tolk.py", line 13, in <module>
    _tolk = cdll.Tolk
            ^^^^^^^^^
  File "C:\Users\chigo\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 452, in __getattr__
    raise AttributeError(name)
AttributeError: Tolk

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

2 participants