# Accessing /dev/\* serial via python

**URL:** <https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940>\
**Category:** UNO Q\
**Created:** [November 23, 2025, 4:36pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940 "2025-11-23T16:36:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![checco\_ux](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/checco_ux/32/1243357_2.png) [@checco\_ux](https://forum.arduino.cc/u/checco_ux)\
**Post date:** [November 23, 2025, 4:36pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/1 "2025-11-23T16:36:56Z")

</div>

Hi.

For a project I need to access `/dev/ttyACM0` from python on an APP LAB app.

By accessing the board via SSH I'm able to see correctly the device (a usb serial barcode scanner) but when the code is executed it seems that the "app container" can't interact with /dev\*

```arduino
[main] Activating python virtual environment
[main] Requirements already installed.
[main] Using Python 3.13.9 environment at: .cache/.venv
[main] Audited 1 package in 334ms
[main] Clearing cache at: .cache/uv
[main] Removed 6 files (1.1KiB)
[main] Traceback (most recent call last):
[main] File "/app/.cache/.venv/lib/python3.13/site-packages/serial/serialposix.py", line 322, in open
[main] self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
[main] ~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[main] FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyACM0'
[main]
[main] During handling of the above exception, another exception occurred:
[main]
[main] Traceback (most recent call last):
[main] File "/app/python/main.py", line 23, in <module>
[main] main()
[main] ~~~~ ^^
[main] File "/app/python/main.py", line 7, in main
[main] ser = serial.Serial(PORT, BAUD, timeout=1)
[main] File "/app/.cache/.venv/lib/python3.13/site-packages/serial/serialutil.py", line 244, in __init__
[main] self.open()
[main] ~~~~~~~~~ ^^
[main] File "/app/.cache/.venv/lib/python3.13/site-packages/serial/serialposix.py", line 325, in open
[main] raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
[main] serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

```

This is my simple code that I want to run:

```arduino
import serial

PORT = "/dev/ttyACM0"
BAUD = 115200

def main():
    ser = serial.Serial(PORT, BAUD, timeout=1)
    buffer = b""
    print("Pronto, in attesa di scansioni...")
    while True:
        b = ser.read(1)
        if not b:
            continue
        if b in b"\r\n":
            if buffer:
                code = buffer.decode("ascii", errors="ignore")
                print("Letto:", code, flush=True)
                buffer = b""
        else:
            buffer += b

if __name__ == " __main__":
    main()

```

---

<div class="post-metadata">

**Author:** ![KurtE](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kurte/32/1246572_2.png) [@KurtE](https://forum.arduino.cc/u/KurtE)\
**Post date:** [November 23, 2025, 8:16pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/2 "2025-11-23T20:16:13Z")

</div>

Permissions?

What does ls -l /dev/tty\*  
Show for that device?

Owned by dialout?

Does the groups command show that arduino user have dialout listed.  
You might try adduser command to add.

Or add capabilities chmod

---

<div class="post-metadata">

**Author:** ![manchuino](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/manchuino/32/239113_2.png) [@manchuino](https://forum.arduino.cc/u/manchuino)\
**Post date:** [November 24, 2025, 4:33pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/3 "2025-11-24T16:33:38Z")

</div>

@checco_ux

Please see [Issues with extra python packages (evdev) - #11 by ptillisch](https://forum.arduino.cc/t/issues-with-extra-python-packages-evdev/1415895/11) for an explanation on why it is not working.

Cheers.

---

<div class="post-metadata">

**Author:** ![checco\_ux](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/checco_ux/32/1243357_2.png) [@checco\_ux](https://forum.arduino.cc/u/checco_ux)\
**Post date:** [November 24, 2025, 5:03pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/4 "2025-11-24T17:03:18Z")

</div>

@manchuino thanks for the response, so is not possible to get access directly on standard linux i/o inside the container?

It seems counter-intuitive to have a fully fledged linux computer and the capability of connecting usb peripherals but can't use them.

Because the alternative is to expose them to the microcontroller and RPC them to python but from what I could discover the microcontroller can't access usb peripherals

Right now I solved this issue in a way somewhat "discutibile":

python script running as a daemon inside linux (not containerized from applab) that reads data from the barcode scanner -\> saves the last barcode to a txt inside a app lab project -\> app lab app reads it and calls a few REST apis AND at the same time -\> the microcontroller is updated with Bridge to give user feedback via LEDS

---

<div class="post-metadata">

**Author:** ![manchuino](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/manchuino/32/239113_2.png) [@manchuino](https://forum.arduino.cc/u/manchuino)\
**Post date:** [November 24, 2025, 5:05pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/5 "2025-11-24T17:05:10Z")

</div>

Hi @checco_ux

Future releases will allow specifying a list of devices from the host to be shared with the container environment.

Cheers.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 23, 2026, 5:05pm UTC](https://forum.arduino.cc/t/accessing-dev-serial-via-python/1415940/6 "2026-05-23T17:05:12Z")

</div>

Closed on May 23, 2026, 5:05pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
