Python Forum
a module can be found but another cannot
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a module can be found but another cannot
#1
when i try to import ftrgen3 it can be found but ftrgen5 cannot:
Output:
lt2a/ka9wgn /home/ka9wgn 5> py Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ftrgen3 >>> import ftrgen5 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'ftrgen5' >>> lt2a/ka9wgn /home/ka9wgn 6>
here are environment variables with "py":
Output:
lt2a/ka9wgn /home/ka9wgn 6> env|fgrep -i py PYTHONMOD=/home/ka9wgn/py/mod PYTHONSRC=/home/ka9wgn/py/src PYTHONDEV=/home/ka9wgn/py/dev PYTHONUSR=/usr/host/py PYTHONDIR=/home/ka9wgn/py PYTHONCMD=/home/ka9wgn/py/cmd PYTHONDONTWRITEBYTECODE=True PYTHONPATH=/home/ka9wgn:/home/ka9wgn/py:/home/ka9wgn/py/mod:/home/ka9wgn/py/fun PYTHONFUN=/home/ka9wgn/py/fun lt2a/ka9wgn /home/ka9wgn 7>
looking around for these files i see:
Output:
| lt2a/ka9wgn /home/ka9wgn 14> rls +f-il|fgrep ftrgen lt2a/ka9wgn /home/ka9wgn 15> rls +f-il /usr|fgrep ftrgen 156415 fr--r--r-- 2 root root 3655 2021-10-21.12:20:30 /usr/host/lib/ftrgen.py 133438 fr--r--r-- 2 root root 3657 2021-10-21.12:20:30 /usr/host/lib/ftrgen3.py 156412 fr--r--r-- 2 root root 2279 2021-10-21.12:20:30 /usr/host/lib/ftrgen4.py 156413 fr--r--r-- 2 root root 2989 2021-10-21.12:20:30 /usr/host/lib/ftrgen5.py 156414 fr--r--r-- 2 root root 2475 2021-10-21.12:20:30 /usr/host/lib/ftrgen6.py 156415 fr--r--r-- 2 root root 3655 2021-10-21.12:20:30 /usr/local/lib/ftrgen.py 133438 fr--r--r-- 2 root root 3657 2021-10-21.12:20:30 /usr/local/lib/ftrgen3.py 156412 fr--r--r-- 2 root root 2279 2021-10-21.12:20:30 /usr/local/lib/ftrgen4.py 156413 fr--r--r-- 2 root root 2989 2021-10-21.12:20:30 /usr/local/lib/ftrgen5.py 156414 fr--r--r-- 2 root root 2475 2021-10-21.12:20:30 /usr/local/lib/ftrgen6.py lt2a/ka9wgn /home/ka9wgn 16>
what else should i do or look at to find out why ftrgen3 can be found while ftrgen5 cannot be found or how to fix this? i'm not sure these are the right places but i can't see ftrgen3.py located anywhere else. ftrgen4 can also be found and ftrgen6 cannot.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
i found the problem there were symlinks that made ftrgen3 work and were missing for ftrgen5. i found this after running python via strace in Linux.
ndc85430 likes this post
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#3
Where does that library come from? Seems weird to be installed directly under a lib directory, rather than in a Python site-packages directory. If it's your own thing, besides installing in a standard directory, I'd also suggest automating that install process (i.e. script it) so you don't lose the knowledge of it and can make sure it's done consistently for all the modules.
Reply
#4
i am scripting it. and doing it in Python. but it will be command line. it's the symlinks that were in a packages directory. i'm still looking for a definition of where everything should be.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
Can't say I know too much about this stuff, but perhaps Distributing Python Modules in the docs can help?
Reply
#6
(Oct-22-2021, 06:48 PM)ndc85430 Wrote: Can't say I know too much about this stuff, but perhaps Distributing Python Modules in the docs can help?

looks like it can.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#7
How can you live with that many PYTHON related environment variable? For me, env|fgrep -i py prints absolutely nothing.
Reply
#8
then your code can work in a wider range of systems than my code. and, i have a lot of other environment variables and commands:
Output:
lt2a/forums /home/forums 5> env|lc 103 lt2a/forums /home/forums 6> ls -1 /usr/host/bin|lc 849 lt2a/forums /home/forums 7>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020