The Dreaded No Module Named....Question (tm)

Hi, topic explains the problem…

However, i think i installede python the way it should be (v2.2.2) and running " import sys print sys.path" produces the path in the console.

The error is: ImportError: No module named os

OS: slackware Linux , with Python 2.2.2 compiled and installede last night.

Let me know if i obmitted any important info…

thx

Update:
When issuing the command “python” (in a terminal) and typing “import sys - print sys.path” it shows the correct path that i set with the export PYTHONPATH=*****
But when running the same command from the text editor in Blender another path appears:

cut
/home/strubi/develop/lib/linux-glibc2.1.2-i386/python/lib/python2.0/plat-linux2’, ‘/home/strubi/develop/lib/linux-glibc2.1.2-i386/python/lib/python2.0/lib-tk’,
cut

Where on earth does it get that path from??

I hope someone can help me :\

that’s probably a residual path from the development version. Not sure how it got there though.

Martin

yes it is, a “cat blender-publisher | grep strubi” shows that it is. It is also in the Creator. How do i get rid of this?

Try a echo $PYTHONPATH in the terminal window before you start blender. Is PYTHONPATH set, do the directories exist?

Weee :smiley: for some reason that worked!

It seems odd though, the path is set at login time, but still blender relies on the hardcoded path… hmm anyway who cares now it works :slight_smile:

thx!

Do you normally start blender from a terminal window or by clicking an icon ? (sidenote: 8 years ago when I started using Linux with Slackware this won’t be a question :wink: )
If you start blender by clicking an icon, the path is probably not set, don’t ask me why, although I have an idea: Is your export PYTHONPATH command in .bashrc or in .profile (/etc/bashrc or /etc/profile respectively)? If it is in bashrc, put it in profile. BTW: It is better to start blender from a terminal-window if you wanna execute some python-scripts, because some of them give useful output.

The /home/strubi part is even in my blender-pythonpath, but it has been appended to my normal pythonpath, and it doesn’t matter if it is there or not as long as the rest is correct.

I hope this makes sense :expressionless:

I can remember reading about Strubi’s python path on the old blender.nl forums, so it has been there for some time. I have it too and it can’t do much harm, unless for some reason you have directories with that name.

To Schlops: Why don’t you add that info to the pythonpath thread? It would be useful to others as well I’m sure.

Actually its a combo :slight_smile:

I tell KDE to open Blender in a terminal so i can see the output, thats why i think its funny that it dosent use the PATH i set. I set it in .bashrc but does that really matter as long as it is being exported? It works IF i open a terminal and launch it and not when launching it from an Icon and tell it to open it in a terminal.

update: Dosen’t help to put it in /etc/profile or copy /etc/profile to ~/.profile

It shouldn’t do much harm even if you are strubi (or have such directories ;)), because it is append to the pythonpath, so your normal path is searched first. Hm, okay there are some crude ways that shit can happen, but hey, then you should re-install your system. :wink:

And as long as the problem isn’t fixed I won’t add this info to the PP 101 thread. So here we go, next question to Clawz: You say you use a combo, desktop-icon with “Open in terminal” set. There is a textfield in the icon-properties window labled “Terminal Options” to set some options for the terminal. I’m sure that there is an option for a login-shell, do a search in the KDE help for that and put it in that textfield. Sorry, I haven’t installed the KDE-helpfiles, I’m low on HD-space. In Windowmaker the option is called -ls, maybe give it a try. :Z

I didn’t mean that, but the info about etc/profile and starting from a terminal, I don’t have much experience with Linux, I might have given the wrong info in that thread.

This dosen’t help im afraid :\

http://www.friserverplads.dk/claws/kdeprop.jpg

I can’t find the so-called Login-shell you talk about - i have looked in the setting for the Terminal also.

Hah, Linux has the Unix philosophy and that means: Keep it in a small in simple way.
Instead of browsing through large helpfiles knowing that there won’t be a solution (that’s one big difference between Win and Lin: The Win helpfiles have the solution for what you seek, but not in the place where you seek), I wrote a very short script:


#!/bin/sh


export PYTHONPATH=/the/import/sys/print/sys.path/listelement/from/python/go/here
/usr/X11R6/bin/blender

Replace the paths according to your system, the Pythonpath as said in the PP 101 thread (import sys print sys.path, or copy the line from your .bashrc). Name this script as you want e.g. bstart and make it executable (chmod a+x bstart) and put it somewhere in your path e.g. /usr/local/bin (the last step should be done as root). In the properties window for your desktop-icon under Execute -> command (see your screenshot) replace blender with bstart and everything should work fine.
BTW: In “Terminal options” you should put something like ls or --ls (and not echo $PP), I’ve tried it and it doesn’t work, the options are passed to blender. :<

To Schlops: Why don’t you add that info to the pythonpath thread? It would be useful to others as well I’m sure.

So it is written and so it shall be done.

You only need to write “export” and obmit the “PYTHONPATH” - that is if you have the pythonpath set in /etc/profile/

Funny thing though - I tried using the same command yesterday ( i know a little UNIX myself thank you :wink: ) but seemingly it wont work if you issue the command “export PYTHONPATH=kjasdfkjhsfdlkahdsflkashf” in the script. That was what i coulden’t figure out. Just use “export”

Thx anyway :smiley: