Hello,
(First of all sorry for my english, but i’m from Belgium )
I just started learning how to work with Python in Blender.
I’m following tutorials about it they say i have to import a GameLogic module, but if i want to test my work, i always get an error [!] : No module named GameLogic . i dont know wath i have to do …
There is a little exception with that module
it can only be imported if your script is launched during the game engine is active
for inst if you create an always sensor, link it to an python scripts, the gamelogic will be available at that time
It sucks because I think (at least) some of the functions of that module should be available. anyways. been through that, know what it is,
you wanna talk about it ?
lol just kidding
Thx for helping me ,
but i still wont work :-? . I’ve checked the console (the dos window that opens with blender. and i found new information … if i start blender i get the message :"" ‘import site’ failed use -v for traceback , noinstalled python found , only build-in modules are available. “”
I have installed python ( i’v downloaded it from the site and installed it and the ‘import site’ thing i dont understand.
though I was writing in english?
why the f@# you want it to work
I just told you it cannot work as the game engine is not active
you cannot imprt gamelogic and launch a script manualy.it must be linked
there are thousands of tuts and doc about that
download blender documentation/reference
do not worry about that console thing
that ‘import site failed’ was there since i downloaded blender the 1st time, years ago
i’ve add an always sensor and connected it to a python controller ( and i filled in the name of my text file ) and it still wont work … i think i’ve insalled python wrong or some things like that … or maybe its somthing else ???
Nope … doesnt work. When i press alt-P iget an error : the name ‘GameLogic’ is not defined. Maybe i’ve installed python wrong ? there are some sites who tells somthing about that but i dont understand it
First:
Make sure you installed Python 2.3.3 (or whatever version in the 2.3 series), NOT Python 2.4. Blender expects Python 2.3.X, it will not work with Python 2.4.
Second:
You can only import the gamelogic module when the game engine is running. That means it will NEVER work if you start a script (Alt-P or otherwise) when Blender is running in “edition mode” . You have to link your script to a gameblender sensor to trigger it after the game engine is start (Pkey or Start Game in the Game menu).
Though his attitude sucks he’s info is correct. In the gameengine the script is called (accessed) as a scriptlink by the logic, not by Alt-P. Look in the Controlers menu and you’ll see an option for Python.
strange that I created the blend file at work wit no python install at all and it was working
anyway, I’ll go for a smoke now
I am glad it helped you and sorry for the rest Teeth
Happy new year anyway