Problem with Lsystem


(Serialsiner) #1

Hi,

I downloaded Lsystem 2 days ago, but I can’t have it run on my PC.
I’m under Win 98 SE, on Blender 2.23.
I’ve created a Lsystem file, so I start Blender, open the blend file and hit Alt+P, but when I hit the Generate button, I just see the script reappearing in the window and get this message in the console :

Traceback (most recent call last):
File “lsystem.py”, line 6, in ?
ImportError: No module named random
failed importing internal module lsystem
trying to import external module…
Traceback (most recent call last):
File “Application.py”, line 447, in bevent
NameError: There is no variable named ‘lsystem_build’

I don’t know anything about Python, so could one of you guys help me about that trouble ?

Thx a lot.

Serialsiner.


(Ed) #2

I was having the same problem with a program name Ter2blend
and yours seem to take almost the same steps ( :-? ?), to give you a better idea read my post on Terblend/python Hope it helps you!

Hey I’m a newbe with python blender, maybe sombody else can help you better than my post!


(theeth) #3

that shows one of two things:

  • you have not installed the full Python distro (needed for the random module in this case)
  • you have installed the full distro but have not set your Pythonpath variable correctly.

Martin


(Serialsiner) #4

Thanks for your replies…

I have the full Python 2.01 installed, but i can’t se any distro in my file.
Is it a module ? Where can I find it ?
More precisions would be helpfull and above all, what should I specify in the autoexec.bat to set the Pythonpath correctly after adding the distro ?

Thanks for your help.

Serialsiner.


(Serialsiner) #5

Well, too bad for my forest … I was really hoping to run this script, but I think I’m gonna do it all from scratch and by hand :frowning:

Serialsiner.


(eeshlo) #6

‘distro’ is distribution, so theeth meant the full python install. That is what you did, so you have to set the PYTHONPATH variable as well, this problem comes up time and time again, so a search in this forum using the keyword PYTHONPATH should point you in the right direction.
But in any case, to save you some time, you have to add something like the following, this is from my autoexec.bat:


SET PYTHONPATH=C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PYTHON20\LIB\LIB-TK

of course this depends on where you installed python, I installed it in C:\Python20, if you have installed it elsewhere, replace the C:\PYTHON20 part with the correct path.


(Serialsiner) #7

Thanks Eeshlo for answering, but adding the lib related code to my Pythonpath had no effect on the script.
I always get the same error in the console.

Although I don’t know Python, I’m wondering if the Application.py script shouldn’t be in the same folder as the Lsystem blend.
I run the script directly from the blend and Blender doesn’t seem to find it.
What I don’t understand is why I can see all the buttons when I hit Alt+P and everything disappears when I hit Generate.

What do I do wrong ? Do I have to link the script to a mesh or an empty before? This script would be useful to a project I’m working on, hope someone will find the solution…


(bgrav) #8

did you look through the python source before pressing ALT-P to see if there is a variable that you have to set to tell the script where the pyhton distribution modules are.

I have downloaded the two scripts in question (LSystem and Ter2Blend) and hopefully I will have the problem solved soon because I also would like to use both scripts to create a nice scene!

I’ll get back to you soon!


(bgrav) #9

eeshlo’s autoexec.bat command works fine. Are you sure that you rebooted your computer after adding the command as autoexec is loaded at startup and changes are not loaded until next boot. However if you are like me and have python 2.20, you can encounter problems with older scripts (lsystem works fine but Ter2Blend does not). Ter2Blend has a problem with the python220.dll, does anyone know where there is an updated version?

Serialsiner, i hope you can get lsystem to work, if not, keep trying!


(Serialsiner) #10

I’ve created a specific folder for defaultdir (C:\Lsytem) as specified in the script, and I’ve rebooted my computer after modifying the autoexec.

I think the problem is elsewhere because I have acces to the Lsystem interface that means that my current version of Python (2.01) is working fine.
I’ve tried to unpack the scripts but nothing occurs.

I’m gonna try something and repost…

Serialsiner.


(Serialsiner) #11

I think I’ve found the key to solve the problem :

The console message indicates an error with the variable lsystem_build, so I just suppressed the line containing this variable (the one at the end of the script beginning by cart_force).

Now the interface doesn’t disappear anymore, the scripts tries to calculate the mesh (generating mesh … ready) but nothing appears in the 3D view, I mean no tree.
This variable must be necessary for the tree to grow but as I told before, I don’t know anything about Python so I need some more help …

Serialsiner.


(eeshlo) #12

I think you make things more complicated than it should, you shouldn’t have to change anything in the script. The script is even one of the few that works without problems in publisher. There really seems to be something wrong with your pythonpath. That the GUI appears has in this case nothing to do with a correct python install as it uses only blender specific stuff. I checked this, when I disable my pythonpath, I can still run the script, but I get the same error as you when I press the generate button. This ‘ImportError’ actually appears right after running the script, but it only fails when you press the ‘generate’ button because only then it tries to use the module that failed to load.

To check if python really detects your PYTHONPATH, try this, type this small piece of code in a blender text window:


import sys
print sys.path

This shows if python indeed uses the pythonpath variable, as all directories are appended to this one. Tell me what you get.
To be sure, also show what exactly you have set in your autoexec.bat

Oh, and in case you don’t know how to get the text window in blender, use shift-F11 and then alt-shift-F and select ‘New’, then type the text above.


(nerddogs) #13

Did you try this yet???..
http://www.geocities.com/nerddogs/ummmm.txt


(eeshlo) #14

This is mentioned all the time, and although this should work with this script, some scripts that happen to need a compiled module will not, as these are not in the lib directory. So the best method is still setting the path variable. On the other hand, for most people this is of course the fastest and easiest solution.
Somebody of the moderators (theeth?) should collect all this info on properly installing python and make it a sticky topic here, it always comes up.


(Serialsiner) #15

So here’s what I get when typing the small piece of code :

[‘C:\PYTHON’, ‘C:\PYTHON\DLLS’, ‘C:\PYTHON\LIB’, ‘C:\PYTHON\LIB\LIB-TK’,
‘’, ‘C:\PROGRAM FILES\BLENDER’, ‘C:\PROGRA~1\BLENDER’, ‘C:\Python’]

And here is my Pythonpath in the autoexec :

SET PYTHONPATH=C:\PYTHON;C:\PYTHON\DLLS;C:\PYTHON\LIB;C:\PYTHON\LIB\LIB-TK

Hope you can detect what’s going wrong.

Serialsiner.


(eeshlo) #16

Well, from this it looks absolutely normal. I forgot one thing though, what do you get if you type the same thing in python itself? To find out, from the ‘start’ menu, in the python2.0 menu there is an option ‘python(commandline)’, select that, then type the exact same thing:


>>> import sys

followed by enter, then


>>> print sys.path

(and enterkey again)

What do you get then?
btw, to exit from python again, use ‘ctrl-z’


(Serialsiner) #17

The Python command line forced me to search the Python.exe manually.
Having 2 exe in my folder (Python_d and Pythonw_d), I choosed the first one and I got that :

‘import site’ failed; use -v for traceback
Python 2.0.1 (#18, Jun 22 2001, 02:26:31) [MSC 32 bit (Intel)] on win32
Type “copyright”, “credits” or “license” for more information.
Adding parser accelerators …
Done.
>>> import sys
[1415 refs]
>>> print sys.path
[’’, ‘C:\PYTHON’, ‘C:\PYTHON\DLLS’, ‘C:\PYTHON\LIB’, ‘C:\PYTHON\LIB\LIB-
TK’, ‘’, ‘C:\PYTHON’]
[1420 refs]
>>>

I don’t know if I did it right … what do you think ?


(sonix) #18

I managed to download the Lsystem yesterday.

I have set my Python 2 path in the Autoexec.bat for my comp. This seems the easiest way. The Lsystem .Blend file should have the Pythonpath set as just :/Lib, if you’ve set the Python path in the Autoexec.Bat you won’t need to change this to anything.

I have created a folder on the C:\ drive for Lsystem. Copy the .DEF files here, from your Lsystem folder if it is in a different location.

Run Lsystem .Blend file. When script appears, use ALT P as directed, and interface runs. In the top part of the interface, enter the name of the >DEF file you wish to use. C:/Lsystem/palm.def . Then click the LOAD button to the left of the file tab, again at the top of the interface.

Then click generate, save the blend as the name of the tree when happy with the results, then use the append function from other .Blends to import your trees.
Runs well in 2.23 and 2.25-(a first for me with publisher).

No further problems encountered. (Win 98 2.23 & 2.25)

Hope this may help you in some way.

Sonix.


(Serialsiner) #19

Thanks to everyone for trying to help me, that’s really cool … but unfortunately this [*?$!!%#] script is driving me crazy !!

Sonixsculpt, I’ve done everything you said, but I always get the same error.

By the way, here is a new one with Blender 2.25 running on the same OS :

imported from text buffer…
Traceback (most recent call last):
File “Application.py”, line 20, in ?
ImportError: No module named lsystem

This is what’s in my Lsystem folder, is it complete ?
textures
bush1.def
bush2.def
fantasy1.def
fantasy2.def
lsystem.blend
palm.def
tree1.def
tree2.def
tree3.def
willow.def


(eeshlo) #20

From what I see sofar, it seems that your python version is the problem. Where did you get that from? The exe files are for debug purposes (_d), it shouldn’t be there as far as I know. All python versions I have (1.5.2, 2.01. 2.1, 2.2.1) all only have python.exe and pythonw.exe, the first one should be the one that is executed. That windows could not find python.exe also indicates something is wrong. And the ‘Import site’ error again indicates that python can’t find pythonpath either, despite that you did set it correctly.
As far as the script is concerned, that is really not the problem at all, you should be able to run it without any changes whatsoever, nothing has to be done to run it, either 2.23 or 2.25, the directory in the script is only for loading predefined trees.

So uninstall python, then re-install python (from python.org), (NOT Python-2.0.1-Debug.zip, which probably is the one you installed by mistake somehow as I’m now beginning to think, on the other hand it doesn’t contain an installer, but does contain the .exe’s you mention), but Python-2.0.1.exe instead.

http://www.python.org/ftp/python/2.0.1/

After you did that, make sure your pythonpath is correct again.