Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start s3e on Windows 10 x64 with Python 3.9.7 x86 #36

Closed
Anton-V-K opened this issue Oct 25, 2021 · 7 comments
Closed

Cannot start s3e on Windows 10 x64 with Python 3.9.7 x86 #36

Anton-V-K opened this issue Oct 25, 2021 · 7 comments

Comments

@Anton-V-K
Copy link

Anton-V-K commented Oct 25, 2021

I'm unable to start s3e on Windows 10 64-bit with Python 3.9.7 32-bit:

C:\Users\Anton>s3e
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python39-32\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files (x86)\Python39-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Program Files (x86)\Python39-32\Scripts\s3e.exe\__main__.py", line 7, in <module>
  File "C:\Program Files (x86)\Python39-32\lib\site-packages\s3_extend\s3e.py", line 202, in s3ex
    S3E()
  File "C:\Program Files (x86)\Python39-32\lib\site-packages\s3_extend\s3e.py", line 49, in __init__
    self.proc_bp = self.start_backplane()
  File "C:\Program Files (x86)\Python39-32\lib\site-packages\s3_extend\s3e.py", line 151, in start_backplane
    if 'backplane' in proc.info['name']:
TypeError: argument of type 'NoneType' is not iterable

Other servers (namely backplane, espgw, wsgw and monitor) run fine, when started individually.

Here is the test script (rewritten fragment of start_backplane from s3e.py):

import psutil

# check to see if the backplane is already running
try:
    for proc in psutil.process_iter(attrs=['pid', 'name']):
        print(proc.info['pid'], proc.info['name']) # list all found processes
        if 'backplane' in proc.info['name']:
            self.skip_backplane = True
            print(proc) # found!
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
    pass

Output:

...>python test_s3e.py
0 System Idle Process
4 System
120 Registry
268 None
Traceback (most recent call last):
  File "D:\Anton\Devel\Arduino\Telemetrix4Esp8266\test_s3e.py", line 9, in <module>
    if 'backplane' in proc.info['name']:
TypeError: argument of type 'NoneType' is not iterable

Screenshot from Task Manager:
2021 10 25-Task_Manager-very_long_process_name

It looks like another bug in psutil - see giampaolo/psutil#1980 where the module can't properly handle long names (due to "bitness mismatch").

I'm not sure whether a process can run without a name, but it may be worth checking the returned string (is it empty?) before trying to search for backplane in it (yeah, it's a kind of hack/workaround).

Another possible workaround it to use same 'bitness' both for Python, and for Windows.

@Anton-V-K Anton-V-K changed the title Cannot start s3e on Windows 10 x64 Cannot start s3e on Windows 10 x64 with Python 3.9.3 x86 Oct 25, 2021
@Anton-V-K Anton-V-K changed the title Cannot start s3e on Windows 10 x64 with Python 3.9.3 x86 Cannot start s3e on Windows 10 x64 with Python 3.9.7 x86 Oct 25, 2021
@MrYsLab
Copy link
Owner

MrYsLab commented Oct 25, 2021

I run s3e in a command window. I've never heard of the composable shell. How does one start the composable shell? I cannot find any documentation about it.

I am not sure if I understand your suggestions. When you say, check the returned string for being empty. Are you referring to this line in your example code?

print(proc) # found!

If that is the line, I don't understand how it can be empty.

When you say the same bitness for both Python and Windows, what are you referring to?

@Anton-V-K
Copy link
Author

Anton-V-K commented Oct 25, 2021

I have no idea what is the process WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.exe, I haven't started it manually/intentionally - probably a Windows application (I run it on a laptop). Actually it can be any process with very long name.

The value in proc.info['name'] may be None (a kind of "not a value" or "no value").
So the quickfix may be simple (until the official fix is released as the new version of psutil):

if proc.info['name'] is not None and 'backplane' in proc.info['name']:
    self.skip_backplane = True
    # ....

If Python is 64-bit then the issue doesn't happen on Windows 64-bit (I haven't checked this though).

@MrYsLab
Copy link
Owner

MrYsLab commented Oct 25, 2021

As you point out, this issue is a problem within psutil. I do not want to make any changes in my code that mask a problem in someone else's. In addition, I do not want to have to change my code again if the psutil fix causes some other issue.

One option for you is to fork s3-extend, make the changes you wish in s3e and save them. Then go to the directory above where the forked version of the s3-extend setup.py file is stored, and then enter:

pip install ./s3-extend --upgrade

You will then have a local copy with the fix. When psutil is repaired, you can always reinstall s3-extend from pypi to have the official version.

Since the s3e file is the only file to be affected, and I do not see any reason to change it at this time, I feel this is the lowest risk solution for both of us.

@MrYsLab
Copy link
Owner

MrYsLab commented Oct 26, 2021

To explain why I am not willing to take on any additional risk in changing the code, here are the download statistics for s3-extend from pepy.

Screenshot from 2021-10-26 08-02-13

Since I cannot test the changes you are requesting, with 35000 users, if something breaks, I will have many unhappy users.

@MrYsLab
Copy link
Owner

MrYsLab commented Oct 27, 2021

I searched the web for articles on windowsinternal.composableshell.experiences.textinput.inputapp.exe, and apparently, it has caused users some issues. There are several articles on disabling and removing it, but since this process does not run on any of my computers, I cannot suggest which, if any, is the best.

There are also articles on forcing short names in Windows, but I do not know if this works for process names.

Perhaps you can experiment with these solutions.

I am going to close this issue, but it can be reopened if necessary.

@MrYsLab MrYsLab closed this as completed Oct 27, 2021
@Anton-V-K
Copy link
Author

psutil 5.9.0 was released, so this issue shouldn't happen any longer

@MrYsLab
Copy link
Owner

MrYsLab commented Jan 6, 2022

I just installed s3-extend using Python 3.9.7 on Windows 10 without any issues. If you are still seeing the same errors you posted above, and still have windowsinternal.composableshell.experiences.textinput.inputapp.exe,
running, then this is something peculiar to your Windows environment. I still have no idea why that application is running on your system and not mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants