boltex/leointeg

Start Server button fails

edreamleo opened this issue · 8 comments

On Windows (leoInteg 1.0.7) with my settings (Use python to launch python), the Start Server button says:

Starting server with command: python c:\Repos\leo-editor/leo/core/leoserver.py --port 32125 An error popup appears: Error - Cannot start server: stderr: Python was not found; run w

But executing python c:\Repos\leo-editor/leo/core/leoserver.py --port 32125 in a separate console does start the server and thereafter the 'Connect to Server' button works and all is well.

The vs code "About" data:

Version: 1.68.1 (system setup)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:48:58.283Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.22000

I changed python to C:\Python\Python3.10\python.exe and everything works.

@boltex I was too quick to declare success.

I can start the server and connect to the server using the "Start Server" and "Connect to Server" buttons. However, the "Start Server" button creates this popup:

Error - Cannot start server: stderr: c:\Repos\leo-editor\leo\core\leoserver.py:1013: DeprecationWarning: There is no current event loop
  asyncio.get_event_loop().create_task(self._asyncIdleLoop(delay / 1000, fn))

But in fact the server has started, even though the "Start Server" button is still visible. Pressing the "Connect to Server" button works.

This also happens when I enable the "Start Server Automatically" setting. Same error. The "Start Server" button is still visible. Whenever the server starts the Leo Log shows:

Starting server with command: C:\Python\Python3.10\python.exe c:\Repos\leo-editor/leo/core/leoserver.py --port 32125

Starting LeoBridge Server 1.0.2 (Launch with -h for help)
LeoServer: init leoBridge in  1.4 sec.
LeoBridge started at localhost on port: 32125.
Ctrl+c to break

And the "Connect to Server" button reports success.

This is highly confusing. Can't wait for LeoJS, hehe.

Looks like this may be a python 3.10 issue. Changing leoInteg's python path setting to
C:\Python\Python3.10\python.exe allows everything to work.

One more glitch. Once leoInteg has connected to the server the "settings wheel" in the leoInteg pane disappears.

I think this issues was perhaps a specific intricacy of python versions/path used. Please feel free to close or add comments to this issue if you can.

Also, about your suggestion for the "settings cog wheel" to stay visible: I need space for more general icons on the main outline view title icons shelf... but in leointeg 1.0.8 (coming out soon after sep. 2), the settings cogwheel will be conveniently always visible on top of the body pane. (screenshot below)
Screenshot from 2022-08-25 17-59-37

@boltex I just tried vs-code and I get this traceback:

Error - Cannot start server: stderr: Traceback (most recent call last):
  File "c:\Repos\leo-editor/leo/core/leoserver.py", line 5265, in <module>
    main()
  File "c:\Repos\leo-editor/leo/core/leoserver.py", line 5215, in main
    controller = LeoServer()  # Single instance of LeoServer, i.e., an instance of leoBridge
  File "c:\Repos\leo-editor/leo/core/leoserver.py", line 855, in __init__
    verbose=False,  # True: prints messages that would be sent to the log pane.
  File "c:\Repos\leo-editor\leo\core\leoBridge.py", line 75, in controller
    verbose)
  File "c:\Repos\leo-editor\leo\core\leoBridge.py", line 98, in __init__
    self.initLeo()
  File "c:\Repos\leo-editor\leo\core\leoBridge.py", line 169, in initLeo
    lm.readGlobalSettingsFiles()
  File "c:\Repos\leo-editor\leo\core\leoApp.py", line 2113, in readGlobalSettingsFiles
    lm.leo_settings_c = lm.openSettingsFile(self.leo_settings_path)
  File "c:\Repos\leo-editor\leo\core\leoApp.py", line 2085, in openSettingsFile
    c = g.app.newCommander(fn)
  File "c:\Repos\leo-editor\leo\core\leoApp.py", line 1498, in newCommander
    relativeFileName=relativeFileName,
  File "c:\Repos\leo-editor\leo\core\leoCommands.py", line 181, in __init__
    c.initObjects(self.gui)
  File "c:\Repos\leo-editor\leo\core\leoCommands.py", line 320, in initObjects
    from leo.commands import convertCommands
  File "c:\Repos\leo-editor\leo\commands\convertCommands.py", line 487, in <module>
    class ConvertCommandsClass(BaseEditCommandsClass):
  File "c:\Repos\leo-editor\leo\commands\convertCommands.py", line 522, in ConvertCommandsClass
    class Add_Mypy_Annotations:
  File "c:\Repos\leo-editor\leo\commands\convertCommands.py", line 628, in Add_Mypy_Annotations
    def do_def(self, m: re.Match) -> str:
AttributeError: module 're' has no attribute 'Match'

@boltex Whoa. Something strange is going on. The re module does have a Match class. I'm confused.

Closing this as per our recent offline discussions: This was caused by custom python installations, and symbolic links/environment path variables used to specify which python/path to use. (vscode execution launched an "exec" command to start the server which was bugged-out by those customizations)