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

[QUESTION] Windows library functions names #281

Open
volga629-1 opened this issue Sep 23, 2024 · 0 comments
Open

[QUESTION] Windows library functions names #281

volga629-1 opened this issue Sep 23, 2024 · 0 comments

Comments

@volga629-1
Copy link

volga629-1 commented Sep 23, 2024

Hello Everyone,
I need help with library functions names.
I am trying basic script

import ctypes
import os

# Path to your .dll file (ensure this is the correct path)
dll_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libzt.dll')
libzt = ctypes.cdll.LoadLibrary(dll_file)
nwid = "bla"
storage_path = os.getcwd()
# Authorization required via my.zerotier.com if this is a private network).
print('Joining virtual network...')
node = libzt.ZeroTierNode()
node.init_from_storage(storage_path)

node.node_start()

while not node.node_is_online():
  time.sleep(1)

print("Node ID:", node.node_id())

node.net_join(nwid)

while not node.net_transport_is_ready(nwid):
  time.sleep(1)

print("IP address: ", node.addr_get_ipv4(nwid))

Script output error

PS C:\Users\rdpmaster\Desktop\app> python3.12 .\test2.py
Joining virtual network...
Traceback (most recent call last):
  File "C:\Users\rdpmaster\Desktop\app\test2.py", line 16, in <module>
    node = libzt.ZeroTierNode()
           ^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 392, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1776.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 397, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: function 'ZeroTierNode' not found

Folders

PS C:\Users\rdpmaster\Desktop\app> dir

    Directory: C:\Users\rdpmaster\Desktop\app

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           9/23/2024  5:13 PM        1094656 libzt.dll
-a---           9/23/2024  5:13 PM        7774436 libzt.lib
-a---           9/23/2024  1:23 PM            383 test.py
-a---           9/23/2024  6:33 PM            795 test2.py

PS C:\Users\rdpmaster\Desktop\app>

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

1 participant