panda3d, pydev and windows xp

Hello everyone,

i seem to have something wrong in my configuration of eclipse/pydev cncerning panda3d. Allthough i can run the small sample prog from the introduction, my IDE still tells me some wierd stuuf. Like that for instance in the line import direct.directbase.DirectStart dirctbase.DirectSTrta is an unresolved import or that loader and base are undefined variables.

So i get an awfull lot of errors and warnings, but untill now evrything still ran alright. BUt since i am a beginner with python and panda3d i would very much like to really see when i am doing something wrong and not some bogus error warnings.

Any idea what i might have missed?

greets Topdoozer

for example:

import direct.directbase.DirectStart

from direct.task import Task
from direct.actor import Actor
import math

environ = loader.loadModel(“models/environment”)
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)

def SpinCameraTask(task):
angledegrees = task.time * 6.0
angleradians = angledegrees * (math.pi / 180.0)
base.camera.setPos(20math.sin(angleradians),-20.0math.cos(angleradians),3)
base.camera.setHpr(angledegrees, 0, 0)
return Task.cont

taskMgr.add(SpinCameraTask, “SpinCameraTask”)

run()

this runs allright but i have lots and warnings and errors from the ide telling me that this little script shouldnt run!

Well, take “loader” and “base.” These are global variables created using python’s “builtins” mechanism. This is an unusual thing to do, and I think it’s not surprising that your IDE doesn’t understand that these are globals.

As for direct.directbase.DirectStart. I imagine it’s looking for a file direct/directbase/DirectStart.py. But in fact, the file is direct/src/directbase/DirectStart.py. It’s probably looking in the wrong place, and concluding erroneously that the file’s not there.

This is one of the difficult things about making a python IDE. Python is an extensible language, you can redefine almost any part of it. So it’s very hard for an IDE to figure out what the program is doing without actually running it.

I think i understand so far. I got the unresolved imports half way right. Now eclipse/pydev only tells me that the imports are unused (which i can life with =8) ). But is there anyway i can tell eclipse/pydev where it can find those basic variables like loader or base or stuff like run() ?

I can tell eclipse where to find certain libs for my python project and there is something called forced builtin libs… any has any experience with that or any idea if i can use it to get panda3d run correctly?

greetz,

TopDoozer

Go to Preferences>Pydev>Interpreter-Python>New folder
now enter the directory where panda3d is located (here its /usr/share/panda3d/, on windows perhaps c:\panda3d-1.4.0)
click Apply and OK and all the libs will be added, you dont have to mess with forced builtin modules…

Hi, I am having the same problem and I’ve done as what pro-rsoft had said, but I still got the errors. Any more ideas?

I heard from another forum that this is a bug from pydev being unable to read static variables from libraries. Is it really unfixable? Anyone using other IDEs is having similar problems?

Thank you in advance

i had similar issue, but once when i would execute program it would all go away(errors and warnings).

Program executes normally.

Hi!

Try this coding style in Eclipse with PyDev:

from direct.showbase import ShowBase

if __name__ == '__main__':
    ShowBase.ShowBase().run()

Another example:

from direct.showbase import ShowBase

if __name__ == '__main__':
    showbase = ShowBase.ShowBase()
    environ = showbase.loader.loadModel('models/environment')
    environ.reparentTo(showbase.render)
    environ.setScale(0.25,0.25,0.25)
    environ.setPos(-8,42,0)
    showbase.run()