Lightflow export: "No module named os" error


(ZoltarX) #1

Hi people.

I have got Lightflow to run on my Linux machine today (Yay!) but get the following error when attempting to export a simple Blender scene using Eeshlo’s script (both current and “new” versions).

PYTHON SCRIPT ERROR:
Traceback (most recent call last):
  File "LFexport_new.py", line 8, in ?
ImportError: No module named os

I am guessing this is because I have incorrectly specified the “root” directory.

Exactly what should I enter as the root directory for a Linux machine? (I am fairly new to Linux and the example in the script is for a DOS directory).

I am working as the user “admin” so all my working are in the directory home/admin/…

Any advice gratefully received!

Regards
ZoltarX


(eeshlo) #2

I have added a bit about PYTHONPATH to the LFPROBLEMS.txt, the Linux section is at the end:

http://www.stormpages.com/eeshlo/VariousPython_files/LFPROBLEMS.txt


(ZoltarX) #3

Thanks eeshlo.

Trouble is, I am still getting the same same error as I reported in my first post - which is…

PYTHON SCRIPT ERROR: 
Traceback (most recent call last): 
File "LFexport_new.py", line 8, in ? 
ImportError: No module named os 

The error occuring line 8 - the first line in the script (“import Blender, Blender210, os, sys”)

Any suggestions about what is wrong would be grately appreciated. :slight_smile:

NOTE RE: .bashrc:

I read your additional notes in the LF_Problems.txt and ran >>> import sys and >>> print sys.path as you suggested.

I entered a new “export PYTHONPATH” line in my .bashrc. My .bashrc now looks like this:

# .bashrc

# User specific aliases and functions

export PYTHONPATH=/usr/lib/python2.2:/usr/lib/python2.2/plat-linux2:/usr/lib/python2.2/lib-dynload:/usr/lib/python2.2/site-packages

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/Lightflow
export PYTHONPATH=$PYTHONPATH:$HOME/Lightflow
export LIGHTFLOWPATH=$HOME/Lightflow
export LIGHTFLOWTEMP=$HOME/Lightflow/LFTEMP

# Source global definitions
if [ -f /etc/bashrc ]; then
 . /etc/bashrc
fi

Sorry for being a pityfull newbie about this :frowning:

Kind Regards
ZoltarX


(eeshlo) #4

These PYTHONPATH problems are always sooo much fun! :-?

I’m just as much a newbie on Linux as you maybe. I searched around for other ways which might solve it (or not). You can also specify paths in .cshrc (but then use ‘setenv’ instead of ‘export’) as well as /etc/profile (use ‘export’).

You have checked the path both when running python from a terminal and Blender?


import sys
print sys.path

Do you have any other python versions on your system?


(theeth) #5

you should also define the path in Blender since it sometimes like to ignore the PYTHONPATH global variable.

  • pull down the info window (where the menu at the top are) and type the path to the LIB directory of your python distro (/home/Python20/Lib/ or something like this) in the Python button at the left.

Martin


(eeshlo) #6

Thanks theeth! I always forget that option…

I will add all of them to the ever growing LF/Python problems list…


(dotblend) #7

i’m not really a lightflow man…, but does your LFexportscript also export (image) texture coordinates? (if yes) is is possible to modify it for the virtualight export script?


(eeshlo) #8

I’m not really ‘a lightflow man’ either, I just happend to get somehow involved with the script. I mean, I like Lightflow very much, great rendering quality if you have the patience to figure it out. But it is getting a bit dated now. And yes, it does export texture coordinates, but the VirtuaLight script does that too, although not quite correctly.
I suppose I could change that for the VL script, but like the LF script, I don’t like changing a script created by somebody else, if I don’t have the permission to do that from the original author. And anyway, I really can’t do much else anymore after I finish the LF script, I HAVE to get back to Dynamica, theeth has been doing everything by himself for the last three months…
If you mean adapting the Lightflow script to VirtuaLight, that would be quite a bit of work, as it now consists of 5000 lines of python code as well as external other code at the moment and still growing…


(ZoltarX) #9

Thanks eeshlo and Theeth!

Yes I have Redhat 7.2 with Python 1.5.2 and 2.2.

You have both given me some new ideas to try out. I will hack arround at it this afternoon.

Cheers
ZoltarX


(eeshlo) #10

Well, that might be the problem, in the Q&A forum you will find a very long thread where I was trying to help Jolly Gnome with the same problem, in the end the only solution for him appeared to be to uninstall python1.5.2, which as you (hopefully) know, you don’t need for Lightflow on Linux anyway.
But I didn’t know about the other options at the time to specify paths, so these might work too.


(ZoltarX) #11

THANKS for this advice people!

It turned out that the solution was the same as for Jolly Gnome. I removed both versions of Python, then reinstalled Python 2.2.

I can now get the old LFexport.py script to run in my old Blender 2.22 which will allow me to get started.

Just a note…If I try to run either the new or old scripts under 2.25 I get error saying “ImportError: No module named Blender210”. - did I hear a rumour there will be a new 2.25 script? :slight_smile:

Thanks again guys! Your time was not wasted.

Regards
ZoltarX


(zanet) #12

This is because python API in blender 2.25 are different…
I heard that blender changed API in 2.10 ( module blender210) but turned back with the old in blender 2.24-2.25… or something like this…


(zanet) #13

sir, i need help:

I’M GOING MAD TRYING TO GET THIS SCRIPT WORKING!!!

i get the horrible " no module named os etc." only whit this script:
the LIGHTFLOWPATH is set and “import sys/print sys.path” works, and if i do a “import os” in python console i get it working…
if i use the script in blender i catch again the os error!
I like lightflow but…

???


(eeshlo) #14

If this script causes you to get mad, try another export script. :wink:
I lost count of how many times this question gets asked, which means there is plenty of information around from all the other people who asked the same question, so if you can’t find any solution using ‘search’ (keywords: PYTHONPATH, Lightflow), I don’t know what I can do to help you. I have heard of cases though that sometimes none of these will work, I can’t do anything about that.

But there is one radical solution posted by BlenderHKU some time ago, that ‘should’ indeed always work: simply put blender in the python lib directory, very ugly, but I can’t see any way that would fail.


(johsahk) #15

If setting all of the other paths does not work you can also put the path into the python script file itself. Example (using the lightflow script as a base):


#replace theses values with your locations
import sys
sys.path=['/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0','/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0/plat-linux2','/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0/lib-dynload','/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0/lib-tk','/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0/site-packages','/mnt/hdd1/opt/python/Python-2.0.1/lib/python2.0/site-packages/PIL']

import Blender, Blender210, os, sys
from math import *
from struct import pack


Just put the import sys stuff above all the other import stuff. This has always solved any problems that the two other methods cannot for me. In addtion you can use this method to point to external modules like eeshlo’s noise mod without having to add them to your pythonpath proper to try them out first.