Skip to content

🐞 running python sdk on windows is not working #3934

@ghost

Description

What is the issue?

The first snippet crashes for incompatibility with the UNIX-specific method calls when following the documentation of the python-SDK guide on a Windows machine.

Log output

$ C:/Users/97254/AppData/Local/Programs/Python/Python311/python.exe c:/Users/97254/Documents/Programing/dagger/test.py
Traceback (most recent call last):
File "c:\Users\97254\Documents\Programing\dagger\test.py", line 30, in
anyio.run(test)
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio_core_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio_backends_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self.loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio_backends_asyncio.py", line 287, in wrapper
return await func(*args)
^^^^^^^^^^^^^^^^^
File "c:\Users\97254\Documents\Programing\dagger\test.py", line 12, in test
async with dagger.Connection(config) as client:
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\dagger\connection.py", line 39, in aenter
return await self.connector.connect()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\dagger\connectors\docker.py", line 168, in connect
await anyio.to_thread.run_sync(self.provision_sync)
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\dagger\connectors\docker.py", line 61, in start os
, arch = get_platform()
^^^^^^^^^^^^^^
File "C:\Users\97254\AppData\Local\Programs\Python\Python311\Lib\site-packages\dagger\connectors\docker.py", line 26, in get_platform uname = os.uname()
^^^^^^^^
AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?

Steps to reproduce

pip install dagger-io

and run the snippet from the documentation:

"""
Execute a command
"""

import sys
import anyio
import dagger

async def test():
    config = dagger.Config(log_output=sys.stderr)

    async with dagger.Connection(config) as client:

        python = (
            client.container()

            # pull container
            .from_("python:3.10-slim-buster")

            # get Python version
            .exec(["python", "-V"])
        )

        # execute
        version = await python.stdout().contents()

        print(f"Hello from Dagger and {version}")

if __name__ == "__main__":
    anyio.run(test)

Dagger version

0.1.1 (dagger-io python client version)

OS version

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions