Opening a theme file doesn't work in Leo 6.1b1

69 views
Skip to first unread message

Viktor Ransmayr

unread,
Oct 29, 2019, 5:16:58 AM10/29/19
to leo-editor
Settings > Open A Theme File doesn't work.

That is I'm able to select a theme file, e.g. BreezeDark2Theme.leo - but - this outline is not opened w/i Leo.

Viktor Ransmayr

unread,
Oct 29, 2019, 5:20:39 AM10/29/19
to leo-editor
Hello Edward, hello Matt,


Am Dienstag, 29. Oktober 2019 10:16:58 UTC+1 schrieb Viktor Ransmayr:
Settings > Open A Theme File doesn't work.

That is I'm able to select a theme file, e.g. BreezeDark2Theme.leo - but - this outline is not opened w/i Leo.

Here's the associated GitHub issue. - https://github.com/leo-editor/leo-editor/issues/1425

I should have done that right away ;-)

With kind regards,

Viktor


Edward K. Ream

unread,
Oct 29, 2019, 9:59:46 AM10/29/19
to leo-editor
On Tue, Oct 29, 2019 at 4:17 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
Settings > Open A Theme File doesn't work.

That is I'm able to select a theme file, e.g. BreezeDark2Theme.leo - but - this outline is not opened w/i Leo.

I can open a theme .leo file, but there is something wrong with the open dialog: it doesn't actually display .leo files.

Edward

Viktor Ransmayr

unread,
Apr 4, 2020, 2:47:56 PM4/4/20
to leo-editor
Hello Edward & Matt,
I'm in the process of re-checking all the issues, that I had reported, when I was using Leo only on a Windows PC ...

This issue ( https://github.com/leo-editor/leo-editor/issues/1425 ) does not seem to be resolved for Linux.

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"'

###

Do you want me to re-open the existing issue - or - create a new issue?

With kind regards,

Viktor

Brian Theado

unread,
Apr 4, 2020, 4:41:37 PM4/4/20
to leo-editor
On Sat, Apr 4, 2020 at 2:47 PM Viktor Ransmayr <viktor....@gmail.com> 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

Viktor Ransmayr

unread,
Apr 5, 2020, 3:14:59 AM4/5/20
to leo-e...@googlegroups.com
Hello Brian,

Yes it does. - I tested your change successfully in Fedora 30 as well as in Windows 10. - Thanks a lot!

With kind regards,

Viktor

Edward K. Ream

unread,
Apr 5, 2020, 6:25:30 AM4/5/20
to leo-editor
On Sat, Apr 4, 2020 at 3:41 PM Brian Theado <brian....@gmail.com> wrote:

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]

Many thanks, Brian, for this sleuthing. I've just created #1564 for this.

Edward
Reply all
Reply to author
Forward
0 new messages