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

Almost working on Windows :) #261

Open
5 of 7 tasks
bagage opened this issue Feb 24, 2020 · 7 comments · May be fixed by #262
Open
5 of 7 tasks

Almost working on Windows :) #261

bagage opened this issue Feb 24, 2020 · 7 comments · May be fixed by #262

Comments

@bagage
Copy link

bagage commented Feb 24, 2020

Hi,

I saw in #101 that you don't intend to support Windows, nonetheless I tried to use it at work and it almost works! If you're OK with it, I can list issues and maybe submit a PR for that:

  • you need to install windows-curses
  • curses.init_pair(0, curses.COLOR_BLACK, bg) raises an exception on windows. Not sure what this code is for, but for now I commented that code. A warning Enhanced colors failed to load appears everytime I quit. curses.init_pair(0) raises ERR zephyrproject-rtos/windows-curses#10
  • this code expects os.environ["TERM"] to always be present but that's not the case on Windows. Maybe we could use os.environ.get("TERM", "") instead?
  • backspace key is toggling help instead of removing last character. edit: It seems that keycodes are retrieving from windows-curses but it never returns keycode, backspace has ord()=8 similarly to ctrl+h hence the help toggle. chr() returns same value for ctrl+h and backspace zephyrproject-rtos/windows-curses#9
  • probably related, but typing [enter] inserts a new space instead of a new line (it behaves like [space]). --> actually no, key_mappings.py must be updated to support ^M to behave like \n.
  • I have not looked for an equivalent of xclip/xsel/pbcopy for windows yet, hence a warning everytime I quit suplemon. edit: clipboard package could do the trick
  • It fails to load Crypto module. You have to install pip install pycrypto but it requires VisualStudio build tools that I cannot install since I am not admin on my machine. I'll test on another machine for this. I actually managed to make suplemon happy: pip uninstall crypto ; pip install pycryptodome.

If interested, I'll continue my investigation to see what's working and what's not in the upcoming days.

Thanks!

@richrd
Copy link
Owner

richrd commented Feb 24, 2020

Hi!

Thanks for testing it out on Windows! If there are no major issues I think we can make some changes as you suggested to support Windows at least on some level. If you're willing to submit a PR that would be very welcome :)

@bagage bagage linked a pull request Feb 28, 2020 that will close this issue
3 tasks
@sergeevabc
Copy link

Windows 7. Suplemon does not work for me as follows

$ pip3 install suplemon
Collecting suplemon                                                                  
  Downloading Suplemon-0.2.1.tar.gz (61 kB)                                          
     |████████████████████████████████| 61 kB 1.5 MB/s                               
Collecting pygments                                                                  
  Downloading Pygments-2.8.1-py3-none-any.whl (983 kB)                               
     |████████████████████████████████| 983 kB 2.2 MB/s                              
Collecting wcwidth                                                                   
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)                             
Using legacy 'setup.py install' for suplemon, since package 'wheel' is not installed.
Installing collected packages: wcwidth, pygments, suplemon                           
    Running setup.py install for suplemon ... done                                   
Successfully installed pygments-2.8.1 suplemon-0.2.1 wcwidth-0.2.5                   

$ suplemon 123.txt                                   
Traceback (most recent call last):                                                 
  File "C:\Python\Scripts\suplemon-script.py", line 33, in <module>                
    sys.exit(load_entry_point('Suplemon==0.2.1', 'console_scripts', 'suplemon')()) 
  File "c:\python\lib\site-packages\suplemon\cli.py", line 36, in main             
    if app.init():                                                                 
  File "c:\python\lib\site-packages\suplemon\main.py", line 108, in init           
    self.ui.init()                                                                 
  File "c:\python\lib\site-packages\suplemon\ui.py", line 123, in init             
    termenv = os.environ["TERM"]                                                   
  File "c:\python\lib\os.py", line 675, in __getitem__                             
    raise KeyError(key) from None                                                  
KeyError: 'TERM'                                                              

@scott91e1
Copy link

All the windows issues have been resolved in this fork: https://github.com/bagage/suplemon

@sergeevabc
Copy link

@scott91e1

$ python --ver && pip3 install suplemon
Python 3.8.8

$ suplemon hello.txt
Traceback (most recent call last):                                                   
  File "C:\Python\Scripts\suplemon-script.py", line 33, in <module>                  
    sys.exit(load_entry_point('Suplemon==0.2.1', 'console_scripts', 'suplemon')())   
  File "c:\python\lib\site-packages\suplemon\cli.py", line 36, in main               
    if app.init():                                                                   
  File "c:\python\lib\site-packages\suplemon\main.py", line 108, in init             
    self.ui.init()                                                                   
  File "c:\python\lib\site-packages\suplemon\ui.py", line 123, in init               
    termenv = os.environ["TERM"]                                                     
  File "c:\python\lib\os.py", line 675, in __getitem__                               
    raise KeyError(key) from None                                                    
KeyError: 'TERM'                                                                     

@scott91e1
Copy link

scott91e1 commented Apr 11, 2021

Ah, that name on PyPI.org is the original unpatched version. To install bagage's version:

git clone https://github.com/bagage/suplemon.git
cd suplemon
python setup.py install

That should install the downloaded version in place of the PyPI version.

Nice thing is you can edit the files and run the install again to update the package locally.

You can also run the editor without using setup.py by running suplemon.py in the root directory.

@sergeevabc
Copy link

@scott91e1, sorry, but it’s too buggy, the quality bar has dropped extremely low.

$ python suplemon.py
2021-04-11 13:44:12,270 - suplemon.config - INFO - Failed to load config file 'C:\Users\***\.config\suplemon\suplemon-config.json'. 
2021-04-11 13:44:12,453 - suplemon.module_loader - ERROR - Failed loading module: crypt                                                   
Traceback (most recent call last):                                                                                                        
  File "C:\Python\Scripts\suplemon\suplemon\module_loader.py", line 66, in load_single                                                    
    mod = imp.load_source(name, path)                                                                                                     
  File "C:\Python\lib\imp.py", line 171, in load_source                                                                                   
    module = _load(spec)                                                                                                                  
  File "<frozen importlib._bootstrap>", line 702, in _load                                                                                
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked                                                                       
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module                                                                 
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed                                                            
  File "C:\Python\Scripts\suplemon\suplemon\modules\crypt.py", line 5, in <module>                                                        
    from Crypto import Random                                                                                                             
ModuleNotFoundError: No module named 'Crypto'                                                                                             
2021-04-11 13:44:12,645 - suplemon.module_loader - ERROR - Failed loading module: system_clipboard                                        
Traceback (most recent call last):                                                                                                        
  File "C:\Python\Scripts\suplemon\suplemon\module_loader.py", line 66, in load_single                                                    
    mod = imp.load_source(name, path)                                                                                                     
  File "C:\Python\lib\imp.py", line 171, in load_source                                                                                   
    module = _load(spec)                                                                                                                  
  File "<frozen importlib._bootstrap>", line 702, in _load                                                                                
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked                                                                       
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module                                                                 
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed                                                            
  File "C:\Python\Scripts\suplemon\suplemon\modules\system_clipboard.py", line 7, in <module>                                             
    import pyperclip                                                                                                                      
ModuleNotFoundError: No module named 'pyperclip'                                                                                          

@scott91e1
Copy link

scott91e1 commented Apr 11, 2021

both of those import errors are coming from optional modules, you can remove the modules or run:

pip install pycrypto
pip install paperclip

if you find this frustrating then nano is available on windows via the choco package mananger:

choco install nano

and I disagree about the quality of suplemon, the project runs really well on windows with a small number of modifications.

Why are you interesting in this project if you cannot figure out how to fix Python import issues?

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

Successfully merging a pull request may close this issue.

4 participants