Generated by Generative AI
No response
Operating System:
Microsoft Windows [Version 10.0.26200.8875]
ROS version or commit hash:
rolling
RMW implementation (if applicable):
No response
RMW Configuration (if applicable):
No response
Client library (if applicable):
No response
'ros2 doctor --report' output
ros2 doctor --report
Steps to reproduce issue
pixi shell
ros2 run rqt_bag rqt_bag
Expected behavior
working
Actual behavior
Traceback (most recent call last):
File "\?<path_to>\ros_ws.pixi\envs\default\Library\bin\ros2-script.py", line 33, in
sys.exit(load_entry_point('ros2cli==0.41.1', 'console_scripts', 'ros2')())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "<path_to>\ros_ws.pixi\envs\default\Lib\site-packages\ros2cli\cli.py", line 91, in main
rc = extension.main(parser=parser, args=args)
File "<path_to>\ros_ws.pixi\envs\default\Lib\site-packages\ros2run\command\run.py", line 110, in main
return run_executable(path=path, argv=args.argv, prefix=prefix)
File "<path_to>\ros_ws.pixi\envs\default\Lib\site-packages\ros2run\api_init_.py", line 64, in run_executable
process = subprocess.Popen(cmd)
File "<path_to>\ros_ws.pixi\envs\default\Lib\subprocess.py", line 1039, in init
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<path_to>\ros_ws.pixi\envs\default\Lib\subprocess.py", line 1553, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
OSError: [WinError 193] %1 は有効な Win32 アプリケーションではありません。
Additional information
Many executables of ros2 , such as rqt_bag, are python codes without ".py" extension, but Windows doesn't recognize shebang without py.exe, and pixi doesn't use py.exe.
I'm not sure whether there are any mechanisms of generating execution wrappers for them in case of Windows, or they weren't work for some reasons.
My suggestion is to add checking a shebang of an executable on running. I'm afraid I've not covered all the possible shebangs for Python.
|
if os.name == 'nt' and path.endswith('.py'): |
def _check_shebang_python(path):
import re
shebang_python_cmds=["/usr/bin/env python3", "/usr/bin/python3", "/usr/bin/env python", "/usr/bin/python"]
with open(path,"r") as fp:
if fp.read(2) == '#!': #shebang
shebang_cmd=re.sub("[\r\n]+$","",fp.readline())
if shebang_cmd in shebang_python_cmds:
return True
return False
def run_executable(*, path, argv, prefix=None):
cmd = [path] + argv
if os.name == 'nt' and ( path.endswith('.py') or _check_shebang_python(path) ):
cmd.insert(0, sys.executable)
Generated by Generative AI
No response
Operating System:
Microsoft Windows [Version 10.0.26200.8875]ROS version or commit hash:
rolling
RMW implementation (if applicable):
No response
RMW Configuration (if applicable):
No response
Client library (if applicable):
No response
'ros2 doctor --report' output
ros2 doctor --report
<COPY OUTPUT HERE>Steps to reproduce issue
pixi shellros2 run rqt_bag rqt_bagExpected behavior
working
Actual behavior
Additional information
Many executables of ros2 , such as rqt_bag, are python codes without ".py" extension, but Windows doesn't recognize shebang without py.exe, and pixi doesn't use py.exe.
I'm not sure whether there are any mechanisms of generating execution wrappers for them in case of Windows, or they weren't work for some reasons.
My suggestion is to add checking a shebang of an executable on running. I'm afraid I've not covered all the possible shebangs for Python.
ros2cli/ros2run/ros2run/api/__init__.py
Line 58 in 4eaefee