mezmorize icon indicating copy to clipboard operation
mezmorize copied to clipboard

pgrep break windows

Open sottom opened this issue 6 years ago • 4 comments

The pgrep command used on the line at the link below breaks when run on Windows. The error is: FileNotFoundError: [WinError 2] The system cannot find the file specified

Find a system agnostic way of doing it (using straight python perhaps).

https://github.com/reubano/mezmorize/blob/82655e376233741fcf7e1745414b50fd8cbefd3f/mezmorize/utils.py#L96

sottom avatar Aug 26 '19 15:08 sottom

Idea: see if flask-caching does anything similar...

reubano avatar Aug 26 '19 21:08 reubano

This library looks like it might be a good option: https://github.com/giampaolo/psutil. https://thispointer.com/python-get-list-of-all-running-processes-and-sort-by-highest-memory-usage/

sottom avatar Sep 03 '19 16:09 sottom

https://psutil.readthedocs.io/en/latest/#filtering-and-sorting-processes

reubano avatar Sep 03 '19 20:09 reubano

same here

Traceback (most recent call last):
  File "...\processors.py", line 9, in <module>
    from mezmorize import Cache
  File "C:\Users\...\AppData\Roaming\Python\Python37\site-packages\mezmorize\__init__.py", line 24, in <module>
    from . import backends
  File "C:\Users\...\AppData\Roaming\Python\Python37\site-packages\mezmorize\backends.py", line 22, in <module>
    from .utils import (
  File "C:\Users\...\AppData\Roaming\Python\Python37\site-packages\mezmorize\utils.py", line 101, in <module>
    HAS_REDIS = redis and pgrep('redis')
  File "C:\Users\...\AppData\Roaming\Python\Python37\site-packages\mezmorize\utils.py", line 96, in pgrep
    return any_env or call(['pgrep', process]) == 0
  File "C:\tools\Anaconda3\envs\ptpip\lib\subprocess.py", line 339, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\tools\Anaconda3\envs\ptpip\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\tools\Anaconda3\envs\ptpip\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

FarisHijazi avatar Dec 18 '22 20:12 FarisHijazi