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

Occasional TypeError on NoneType #8

Open
mctinker opened this issue Aug 25, 2024 · 2 comments
Open

Occasional TypeError on NoneType #8

mctinker opened this issue Aug 25, 2024 · 2 comments

Comments

@mctinker
Copy link

This only occurs occasionally, and I don't see anything wrong on my end...
Traceback (most recent call last):
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/main.py", line 40, in
main()
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/main.py", line 21, in main
return_code = mapit.mapit_all("")
^^^^^^^^^^^^^^^^^^^
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapit.py", line 716, in mapit_all
do_rerun()
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapit.py", line 558, in do_rerun
restart_program()
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapit.py", line 537, in restart_program
_ = mapit_all("")
^^^^^^^^^^^^^
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapit.py", line 702, in mapit_all
map_ai()
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapai.py", line 283, in map_ai
local_ai(query, ai_object, item)
File "/Users/mikrubin/Library/CloudStorage/[email protected]/My Drive/Python/maptasker/maptasker/src/mapai.py", line 109, in local_ai
with cria.Model(PrimeItems.program_arguments["ai_model"]) as ai:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/cria.py", line 280, in init
super().init(
File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/cria.py", line 194, in init
ollama_process = find_process(["ollama", "serve"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/cria.py", line 168, in find_process
if proc_command[: len(command)] != command:
~~~~~~~~~~~~^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

@mctinker
Copy link
Author

The query was...
"Given the following Profile in Tasker, an Android automation tool, how could it be improved for performance and readibility: (Tasker Profile here)"
Python 3.12.4
OS X 14.6.1
Cria 1.6.6

@mctinker
Copy link
Author

The fix:
In function "find_process", modify the line...
if process_name.lower() in proc.name().lower():
...to...
if process_name.lower() in proc.name().lower() and proc.info["cmdline"] is not None:

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

1 participant