Cannot understand the error

255 views
Skip to first unread message

Nishtha Sharma

unread,
Jul 5, 2021, 6:28:30 PM7/5/21
to oTree help & discussion
Hi,

When I ran the otree devserver command to test my code on my local server, I got the following prompt on my python terminal. Can you recognize what this is and help me with what I might need to do.

System check identified no issues (0 silenced).
Creating new database
INFO Created superuser "admin"
Open your browser to http://localhost:8000/
To quit the server, press Control+C.
Traceback (most recent call last):
  File "/Users/nishtha/opt/anaconda3/bin/otree", line 8, in <module>
    sys.exit(execute_from_command_line())
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/otree_startup/__init__.py", line 181, in execute_from_command_line
    fetch_command(subcmd).run_from_argv(argv)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/otree/management/commands/devserver_inner.py", line 155, in handle
    run_asgi_server(addr, port, is_devserver=True)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/otree/management/commands/prodserver1of2.py", line 14, in run_asgi_server
    run_hypercorn(addr, port, is_devserver=is_devserver)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/otree/management/commands/prodserver1of2.py", line 41, in run_hypercorn
    loop.run_until_complete(serve(application, config))
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/hypercorn_otree/asyncio/__init__.py", line 39, in serve
    await worker_serve(app, config, shutdown_trigger=shutdown_trigger)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/hypercorn_otree/asyncio/run.py", line 69, in worker_serve
    sockets = config.create_sockets()
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/hypercorn_otree/config.py", line 165, in create_sockets
    insecure_sockets = self._create_sockets(self.bind)
  File "/Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/hypercorn_otree/config.py", line 213, in _create_sockets
    sock.bind(binding)
OSError: [Errno 48] Address already in use
ERROR Task was destroyed but it is pending!
task: <Task pending coro=<Lifespan.handle_lifespan() running at /Users/nishtha/opt/anaconda3/lib/python3.7/site-packages/hypercorn_otree/asyncio/lifespan.py:30> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9824a79450>()]>>

Thanks a lot,
Nishtha

Chris @ oTree

unread,
Jul 5, 2021, 7:03:35 PM7/5/21
to Nishtha Sharma, oTree help & discussion
The key phrase here is:

OSError: [Errno 48] Address already in use

This means that there is another server process already running on that port. I guess you are running oTree in another window. Try closing all your shell windows and try again.

Unfortunately I have not found a way to override this error message with something friendlier. On oTree 5 it is somewhat better though. 

Sent from my phone

Nishtha Sharma

unread,
Jul 6, 2021, 1:54:43 AM7/6/21
to Chris @ oTree, oTree help & discussion
Thanks a lot, Chris. This was it!

Regards,
Nishtha

Reply all
Reply to author
Forward
0 new messages