Cannot turn off local server

81 views
Skip to first unread message

Evan Kirkiles

unread,
Apr 10, 2021, 7:37:16 PM4/10/21
to PsiTurk
I'm getting a weird bug whenever I try to turn off the development server. With enough mashing of CTRL+D and CTRL+C it eventually turns off, but I think this is also preventing me from being able to use the debug functionality of the server as well (need to fully stop and start it every time for any changes to be reflected). The error I get is:

[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 71, in helper_fn
    return func(self, opt)
  File "/usr/local/lib/python3.9/site-packages/psiturk/psiturk_shell.py", line 573, in do_server
    self.server_off()
  File "/usr/local/lib/python3.9/site-packages/psiturk/psiturk_shell.py", line 165, 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'

Any / all help would be appreciated!

Dave Eargle

unread,
Apr 10, 2021, 8:00:16 PM4/10/21
to Evan Kirkiles, PsiTurk
We don't have any testing against versions of python greater than 3.8, does the same thing happen for 3.6 3.7 or 3.8? 

--
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/c64d3517-3372-4037-bf26-cc20fbe171ddn%40googlegroups.com.

Evan Kirkiles

unread,
Apr 10, 2021, 8:02:30 PM4/10/21
to PsiTurk
I didn't even notice that it's running python3.9 there––regardless, the same thing happens in 3.7.4

Dave Eargle

unread,
Apr 10, 2021, 8:08:01 PM4/10/21
to Evan Kirkiles, PsiTurk
I also notice you're on a Mac, I think? Something is breaking in psutil, looks like, that doesn't break when I run on Ubuntu. Hard to debug. 

Dave Eargle

unread,
Apr 10, 2021, 8:08:59 PM4/10/21
to Dave Eargle, Evan Kirkiles, PsiTurk
Also, try running within a virtualenv of some kind, to rule out something strange.

Evan Kirkiles

unread,
Apr 10, 2021, 8:10:50 PM4/10/21
to PsiTurk
I have been, and this happens every time... It wasn't an issue back in v2.3.11, but I updated to v3 and now both are broken like this. It's not too big of a deal, but it just adds in extra steps during development. Gonna try restarting my computer right now.

Dave Eargle

unread,
Apr 10, 2021, 9:57:09 PM4/10/21
to Evan Kirkiles, PsiTurk, Jacob Lee
Your stack trace posted above suggests that you are _not_ using a virtualenv -- at least not for that run.

@jacob, do you have any insight into what might be happening there?


Dave Eargle

unread,
Apr 11, 2021, 1:26:48 AM4/11/21
to Dave Eargle, Evan Kirkiles, PsiTurk, Jacob Lee
Also @evan you may be interested to know that you can do something like the following to get a flask debugging server running, which live-reloads changes to custom.py etc, so you don't have to keep shutting off and restarting your server. I put this in a file called `app.py`, which I run via `python app.py`. You could also use `flask run` with something similar.

image.png

Evan Kirkiles

unread,
Apr 11, 2021, 1:37:42 PM4/11/21
to PsiTurk
Thanks––this is what I was looking for, just wasn't sure if the Flask debugging server was rolled into PsiTurk (I seem to remember that being the case in older versions of PsiTurk, is that maybe not so now?). It's pretty clear my problem was with Gunicorn, and I was waiting on just running up a debug Flask server in case I could quickly solve the Gunicorn problem as well. Regardless, this works fine for me! Thank you!!!

Jacob Lee

unread,
Apr 12, 2021, 3:54:33 PM4/12/21
to Dave Eargle, Evan Kirkiles, PsiTurk
On Mac OS 11.2.3, I created a conda environment with python 3.8.8 and installed psiturk 3.1.0 from PyPi using pip. I started and stopped the server both from the command line and in interactive mode. I had no issues.

The permission issue sounds like the sort of the thing that seems to come up on the "enhanced" security model of newer versions of Mac OS. Where is the psiturk application installed?

Jacob


Reply all
Reply to author
Forward
0 new messages