Open tomtom1337 opened 1 year ago
Recommendation is to install your dependencies into a virtual environment
Recommendation is to install your dependencies into a virtual environment
This does not solve my issue... still No module named 'twitter'
.
The only solution is to add modules.
to load the local modules correctly
Can you reproduce how did you install the project requirements for us?
Did you change any folder names?
sys.path.append(os.path.abspath('./modules'))
This should import the location of all of the modules into the script.
I've tried it on a fresh installation of Linux Mint 21.1 in Virtual Box:
v@v-VirtualBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description: Linux Mint 21.1
Release: 21.1
Codename: vera
v@v-VirtualBox:~$ python3 --version
Python 3.10.6
Installation:
@v-VirtualBox:~$ git clone https://github.com/jakecreps/poastal
Klone nach 'poastal' …
remote: Enumerating objects: 178, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 178 (delta 29), reused 0 (delta 0), pack-reused 101
Empfange Objekte: 100% (178/178), 150.11 KiB | 3.00 MiB/s, fertig.
Löse Unterschiede auf: 100% (65/65), fertig.
v@v-VirtualBox:~$ cd poastal/
v@v-VirtualBox:~/poastal$ pip install -r requirements.txt
[ ... ]
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 Werkzeug-2.2.3 flask-2.2.3 flask_cors-3.0.10 itsdangerous-2.1.2
v@v-VirtualBox:~/poastal$ python3 backend/poastal.py
Traceback (most recent call last):
File "/home/v/poastal/backend/poastal.py", line 7, in <module>
from twitter import twitter_email
ModuleNotFoundError: No module named 'twitter'
I've added print(sys.path)
to check if the sys.path.append
is working:
['/home/v/poastal/backend', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/v/.local/lib/python3.10/site-packages', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.10/dist-packages', '/home/v/poastal/modules']
Only solution is to load all the local modules with
from modules.xxx import xxx
weird. Was trying to troubleshoot why I never get a prompt to enter an email and I did notice this...
If I run the poastal.py from the poastal directory like this then I get this module error. But if I cd into backend and then run it it seems to start fine (but I can never find a place to enter the email as the web page just shows "no email provided."
$ python ./backend/poastal.py
Traceback (most recent call last):
File "/home/user/poastal/./backend/poastal.py", line 7, in
vs
$ python ./poastal.py
So the problem is that if you don't run poastal.py
from the backend
folder itself it throws the ModuleNotFoundError
because it looks for .../poastal/modules
instead of .../poastal/backend/modules
So you may close this issue or you can add my workaround modules.xxxx
to run poastal.py
from anywhere 😄
Hi and thanks for the great work!
I've got an issue with loading the local twitter module from the modules folder:
Workaround for me was to add the modules folder to the import command in the
poastal.py
And now it's working :)