Forums

/usr/bin/env python3: no such Python interpreter 2021-02-05 14:19:06 -- Completed task, took 1.54 seconds, return code was 0.

Hi I have this error.. i searched before write and try

/usr/bin/python3 with out env

and i get this error:

Traceback (most recent call last):
  File "/home/pepew/algostock/dashboard/loadcloseprice.py", line 11, in <module>
    application = get_wsgi_application()
  File "/usr/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/lib/python3.5/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/usr/lib/python3.5/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/usr/lib/python3.5/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python3.5/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/pepew/algostock/algostock/settings.py", line 146, in <module>
    os.path.join(BASE_DIR, 'templates'),
  File "/usr/lib/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'PosixPath'

2021-02-04 14:52:05 -- Completed task, took 2.65 seconds, return code was 1.

In my console works perfectly, but when i send to Tasks i have the problem..

My program begins like that:

#!/usr/bin/env python3
import os, sys
sys.path.append('/home/pepew/.virtualenvs/myproject/lib/python3.8/site-packages')
proj_path = "/home/pepew/algostock/"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "algostock.settings")
sys.path.append(proj_path)
os.chdir(proj_path)


from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

from pandas_datareader import data as pdr
from dashboard.models import trade

Thank you in advance

pepew

[edited by admin- formatting]

you want to use something like /home/pepew/.virtualenvs/myproject/bin/python

Hi conrad

I changed to:

#!/usr/bin/python3
import os, sys
sys.path.append('/home/pepew/.virtualenvs/myproject/bin/python')
proj_path = "/home/pepew/algostock/"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "algostock.settings")
sys.path.append(proj_path)
os.chdir(proj_path)

don't works

i changed to:

#!/usr/bin/env python3
import os, sys
sys.path.append('/home/pepew/.virtualenvs/myproject/bin/python')

and i get this error:

Traceback (most recent call last):
  File "/home/pepew/algostock/dashboard/loadcloseprice.py", line 11, in <module>
    application = get_wsgi_application()
  File "/usr/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/usr/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'admin_interface'

Dont't works Thanks

[edit by admin: formatting]

i try this now and works thanks :))))) Before i also tried, but i must kill the console and exit before try again.

#!/home/pepew/.virtualenvs/myproject/bin/python
import os, sys
sys.path.append('/home/pepew/.virtualenvs/myproject/lib/python3.8/site-packages

Perfect!!

[edit by admin: formatting]