On Sat, Apr 4, 2020 at 2:47 PM Viktor Ransmayr <[email protected]>
wrote:

> At least not for Fedora 30. - See the following traceback I received, when
> I tried to open a theme file!
>
> Traceback (most recent call last):
>
>   File
> "/home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/core/leoCommands.py",
> line 2286, in executeAnyCommand
>     return command(event)
>   File
> "/home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/core/leoGlobals.py",
> line 245, in commander_command_wrapper
>     method(event=event)
>   File
> "/home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/commands/commanderFileCommands.py",
> line 1025, in open_theme_file
>     g.subprocess.Popen(command)
>   File "/usr/lib64/python3.7/subprocess.py", line 800, in __init__
>     restore_signals, start_new_session)
>   File "/usr/lib64/python3.7/subprocess.py", line 1551, in _execute_child
>     raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory:
> '/home/user/PyVE/PyPI/Leo-stable/bin/python3
> /home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/core/runLeo.py
> "/home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/themes/ZephyrDarkTheme.leo"':
> '/home/user/PyVE/PyPI/Leo-stable/bin/python3
> /home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/core/runLeo.py
> "/home/user/PyVE/PyPI/Leo-stable/lib64/python3.7/site-packages/leo/themes/ZephyrDarkTheme.leo"'
>

 I've never used this command before and I just tried it and I get a
similar error.

https://github.com/leo-editor/leo-editor/commit/016867f5ade5da6796397ab4705287bf8b8f336a
-
this is the commit which fixed #1425 for Windows by using subprocess.Popen
instead of os.system.

The documentation for subprocess.Popen looks complicated:
https://docs.python.org/3/library/subprocess.html and it looks like the
behavior is different for windows and Posix.

"args should be a sequence of program arguments or else a single string or
path-like object. By default, the program to execute is the first item in
args if args is a sequence. *If args is a string, the interpretation is
platform-dependent and described below*"

and

"*Unless otherwise stated, it is recommended to pass args as a sequence*"

So maybe passing as a list rather than string will work for both platforms.
Instead of this:

command = f'{g.sys.executable} {g.app.loadDir}/runLeo.py "{fn}"'


this

command = [g.sys.executable, f"{g.app.loadDir}/runLeo.py", fn]


Brian

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAO5X8CyYHCStkxe1UJxrUN4p1zxOWdGNQCFUo%3Djm5rtRz6efWg%40mail.gmail.com.

Reply via email to