Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5273

Troubleshooting • 'command not found' but only when running daphne using sudo

$
0
0
Trying to run daphne on port 443.

This is the command: sudo daphne -e ssl:443:privateKey=/etc/ssl/mycerts/apache.key:certKey=/etc/ssl/mycerts/apache.pem myProject.asgi:application

The following error is generated: sudo: daphne: command not found

running which sudo returns /usr/bin/sudo -- sudo is installed.

running which daphne returns /home/pi/.local/bin/daphne -- daphne is installed.

echo $PATH returns /home/pi/.local/bin:/lib/python3.9:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

Both /usr/bin and /home/pi/.local/bin are on the PATH.

I can run daphne on port 8001 (without sudo) without any problems (ex. daphne -b 0.0.0.0 -p 8001 myProject.asgi:application)

Based on some feedback from another forum I ran this with full path reference for daphne (sudo /home/pi/.local/bin/Daphne) and the error changed to the following:
Traceback (most recent call last): File "/home/pi/.local/bin/daphne", line 5, in <module> from daphne.cli import CommandLineInterface ModuleNotFoundError: No module named 'Daphne'

I also added the full reference to daphne to the PYTHONPATH. That had no impact from what I could tell.

Why does the error 'command not found' appear if sudo is installed, daphne is installed and both locations are on the PATH?

Statistics: Posted by avanderkolk — Sat Jan 06, 2024 2:28 am



Viewing all articles
Browse latest Browse all 5273

Trending Articles