Can't turn the server off, or restart. Commands not working

48 views
Skip to first unread message

John Mark Johnson

unread,
Jun 22, 2021, 6:25:50 PM6/22/21
to PsiTurk

Hi there,

Everything has been working well with my psiturk experiment. However, today I tried to reload the server and debug an experiment and I am getting an unusual error that is causing me to go crazy:

[psiTurk server:on mode:sdbx #HITs:0]$ server off
EXCEPTION of type 'FileNotFoundError' occurred with message: '[Errno 2] No such file or directory'
To enable full traceback, run the following command: 'set debug true'
[psiTurk server:on mode:sdbx #HITs:0]$ set debug true
debug - was: False
now: True
[psiTurk server:on mode:sdbx #HITs:0]$ server off
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cmd2/cmd2.py", line 1581, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
  File "/usr/local/lib/python3.9/site-packages/cmd2/cmd2.py", line 1977, in onecmd
    stop = func(statement)
  File "/usr/local/lib/python3.9/site-packages/psiturk/psiturk_shell.py", line 72, in helper_fn
    return func(self, opt)
  File "/usr/local/lib/python3.9/site-packages/psiturk/psiturk_shell.py", line 574, in do_server
    self.server_off()
  File "/usr/local/lib/python3.9/site-packages/psiturk/psiturk_shell.py", line 166, in server_off
    self.server.shutdown()
  File "/usr/local/lib/python3.9/site-packages/psiturk/experiment_server_controller.py", line 141, in shutdown
    psiturk_master_procs = [p for p in psutil.process_iter(
  File "/usr/local/lib/python3.9/site-packages/psiturk/experiment_server_controller.py", line 141, in <listcomp>
    psiturk_master_procs = [p for p in psutil.process_iter(
  File "/usr/local/lib/python3.9/site-packages/psutil/__init__.py", line 1571, in process_iter
    proc.info = proc.as_dict(
  File "/usr/local/lib/python3.9/site-packages/psutil/__init__.py", line 639, in as_dict
    ret = meth()
  File "/usr/local/lib/python3.9/site-packages/psutil/__init__.py", line 774, in exe
    exe = self._proc.exe()
  File "/usr/local/lib/python3.9/site-packages/psutil/_psosx.py", line 338, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/psutil/_psosx.py", line 417, in exe
    return cext.proc_exe(self.pid)
FileNotFoundError: [Errno 2] No such file or directory
EXCEPTION of type 'FileNotFoundError' occurred with message: '[Errno 2] No such file or directory'
[psiTurk server:on mode:sdbx #HITs:0]$ 


Does anyone have any clue what I can do?

Dave Eargle

unread,
Jun 22, 2021, 6:40:31 PM6/22/21
to John Mark Johnson, Jacob Lee, PsiTurk
Somebody else posted about this, I think they were also using python 3.9, something to do with psutil looking for a pid file on osx. Search for psutil on the Google group. And cc @Jacob Lee who worked in this code area most recently, do you have any insight here?

--
You received this message because you are subscribed to the Google Groups "PsiTurk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psiturk+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psiturk/eb206fc6-c0bf-400c-9de9-627dd3645c2fn%40googlegroups.com.

Dave Eargle

unread,
Jun 22, 2021, 8:04:39 PM6/22/21
to PsiTurk
Here's @jacob's response on the previous thread about this, suspecting it's related to mac os security: https://groups.google.com/g/psiturk/c/BfzaSWtxqBY/m/8Cq1RxlLCQAJ

John Mark Johnson

unread,
Jun 22, 2021, 9:58:58 PM6/22/21
to PsiTurk
I read through it but I'm not quite sure what they did to get it working.

Furthermore, my debug is completely not running now and is showing internal server error.

When I look at the server log it gives me the following:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psiturk/user_utils.py", line 22, in new_func
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psiturk/experiment.py", line 385, in advertisement
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/templating.py", line 155, in render_template_string
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jinja2/environment.py", line 941, in from_string
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jinja2/environment.py", line 638, in compile
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jinja2/environment.py", line 830, in handle_exception
ModuleNotFoundError: No module named 'jinja2.debug'

John Mark Johnson

unread,
Jun 22, 2021, 10:54:15 PM6/22/21
to PsiTurk
I have tried opening the experiment in a virtual environment. It still gets the same error.

You received this message because you are subscribed to a topic in the Google Groups "PsiTurk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psiturk/7DYwjIMbbQM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psiturk+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psiturk/5de53001-349c-46a2-8b17-f8ad335cf07an%40googlegroups.com.

Dave Eargle

unread,
Jun 22, 2021, 11:36:56 PM6/22/21
to John Mark Johnson, PsiTurk
You'll laugh at this given our github convo... have you considered docker? Lol

Try restarting your computer-- psutil was trying to look up something or other to shut down the psiturk server. Restarting should kill it. Or explore using zsh kill commands, ps aux, and the like if you're familiar with those.

After you restart, try launching from a virtual environment, and seeing if you can shut down the server from within there.

Just guesses, hard to say without reprex. If it really is a Mac security thing, docker would help, but I hope a virtualenv is sufficient.

Dave Eargle

unread,
Jun 23, 2021, 11:11:11 AM6/23/21
to John Mark Johnson, PsiTurk
Best practice to always use virtual environments -- development, production, whatever. Except if you're using a container solution such as heroku, not necessary since you're already in an effectual virtual environment. And it's rare to be deploying to any sort of Mac server, so probably nbd.

On Wed, Jun 23, 2021, 8:42 AM John Mark Johnson <johnso...@gmail.com> wrote:
Lol, I guess I would try anything at this point.

It works now. No clue what or why that happened besides the security thing you mentioned.

So, should I run the experiment in a virtual environment when I am actually ready?

John Mark Johnson

unread,
Jun 23, 2021, 3:43:30 PM6/23/21
to Dave Eargle, PsiTurk
thanks again!
Reply all
Reply to author
Forward
0 new messages