0
$\begingroup$

I have some Python code working that reads from a sensor connected to I2C.

As this works, I assume I have all my permissions set up correctly for the I2C interface.

I then wrote a ROS 2 wrapper for the Python code. When I try run (ros2 run) this node I get a PermissionError as follows:

Traceback (most recent call last): File "/opt/ros/jazzy/lib/python3.12/site-packages/launch/actions/execute_local.py", line 569, in __execute_process transport, self._subprocess_protocol = await async_execute_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/ros/jazzy/lib/python3.12/site-packages/osrf_pycommon/process_utils/async_execute_process_asyncio/impl.py", line 139, in async_execute_process transport, protocol = await _async_execute_process_nopty( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/ros/jazzy/lib/python3.12/site-packages/osrf_pycommon/process_utils/async_execute_process_asyncio/impl.py", line 45, in _async_execute_process_nopty transport, protocol = await loop.subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_events.py", line 1744, in subprocess_exec transport = await self._make_subprocess_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/unix_events.py", line 211, in _make_subprocess_transport transp = _UnixSubprocessTransport(self, protocol, args, shell, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 36, in init self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, File "/usr/lib/python3.12/asyncio/unix_events.py", line 820, in _start self._proc = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1840, in _execute_child self._posix_spawn(args, executable, env, restore_signals, File "/usr/lib/python3.12/subprocess.py", line 1784, in _posix_spawn self.pid = os.posix_spawn(executable, args, env, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied:

(address to my node in ws/install) follows "Permission denied:"

Anyone have ideas or things I can try to debug? I have done sudo rosdep fix-permissions in the workspace. The Python file is also executable.

Thanks.

[Jazzy, RaspberryPi5]

$\endgroup$
2
  • $\begingroup$ Hi, in your ros2 workspace, did you tried to execute "sudo chmod -R +x" $\endgroup$ Commented Jul 4 at 7:45
  • $\begingroup$ Thanks for your suggestion @Kevin_dans_son_garage_du_63 . Please see my answer below for the fix. $\endgroup$
    – BryanGD123
    Commented Jul 4 at 15:44

1 Answer 1

2
$\begingroup$

This has been resolved. Ultimately, it was about not using Python virtual envs and ROS 2 correctly. After adding my virtual env's site-packages address to $PYTHONPATH, it then worked.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.