No name 'Point3' in module panda3d.core (Panda3d 1.10.8)

When running the tutorial code provided by the Panda3d documentation, I get the error “No name ‘Point3’ in module ‘panda3d.core’”. I’ve looked up solutions, but the last post was from 2010. What am I doing wrong? This issue appears on both Windows and Mac for me, and I am using the latest Python (3.9.1), Visual Studio Code (1.52.1), and Panda3d (1.10.8) versions.

Welcome.

However, I do not observe such an error.

from direct.showbase.ShowBase import ShowBase
from panda3d.core import Point3

class Game(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        p = Point3()

game = Game()
game.run()

The problem may be the following: you didn’t set bindings for your python version when installing the SDK.

1

I checked my bindings, and have 3.9 enabled. Should I use a different engine than Visual Studio?

You have to use the python that comes with panda. Or use pip to install Panda3D for your version of python. Visual Studio has its own version of python, so it doesn’t know anything about Panda3D.

Could you share your whole code? This error message can only be caused by a lack of importing the module from panda3d.core, or if there is somehow some other module named “panda3d.core” on your system that is not from Panda3D.

A failure to install the bindings will result in a different error message.

Sure, but it’s just the tutorial code, one to one. Im trying to learn the software, and following the manual.

import panda3d
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import Point3
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence

class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        #Disable camera trackball controls
        self.disableMouse()

        #load the environment model
        self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render
        self.scene.reparentTo(self.render)
        #Apply scale and position transforms on the model
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)

        #add the spinCameraTask procedure to the task manager
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")

        #Load and transform the panda actor
        self.pandaActor = Actor("models/panda-model", {"walk": "models/panda-walk4"})
        self.pandaActor.setScale(0.005, 0.005, 0.005)
        self.pandaActor.reparentTo(self.render)
        # Loop its animation.
        self.pandaActor.loop("walk")

        # Create the four lerp intervals needed for the panda to walk back and forth
        posInterval1 = self.pandaActor.posInterval(13, Point3(0, -10, 0), startPos=Point3(0, 10, 0))
        posInterval2 = self.pandaActor.posInterval(13, Point3(0, 10, 0), startPos=Point3(0, -10, 0))
        hprInterval1 = self.pandaActor.posInterval(13, Point3(180, 0, 0), startHpr=Point3(0, 0, 0))
        hprInterval2 = self.pandaActor.hprInterval(3, Point3(0, 0, 0), startHpr=Point3(180, 0, 0))
        

        # Create and play the sequence that coordinates the intervals
        self.pandaPace = Sequence(posInterval1, hprInterval1, posInterval2, hprInterval2, name="pandaPace")
        self.pandaPace.loop()
    # Define a procedure to move the camera
    def spinCameraTask(self, task):
        angleDegrees = task.time * 6.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -20 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont

app = MyApp()
app.run()

I think you may have a panda3d.py or a folder named panda3d somewhere around which is conflicting with the proper Panda3D module. If you do, rename this file or folder.

Unusual development, I retyped my code, to be exact as the tutorial says, and now it runs, but still gives me the error. I can see the panda walk back and forth, but it runs with an error.
I did delete all my panda files and reinstall using pip, so maybe that fixed it?

Edit: The program runs, but still does not recognise panda3d.core. Looks like that didn’t fix it.

You need to be more specific about errors. Do the samples that come with panda work?

Wait, are you getting this error message from Python, or are you getting it from your editor program?

Sorry for the long wait for a reply, but I am getting the error in Visual Studio Code. When I run the code through Command Prompt, I don’t get the same error I do in Visual Studio, even when causing errors on purpose. For example, I imported from panda3d.core a module that doesn’t exist, just to see what happens, and as expected, the program returns an error in both programs, but Visual Studio still gives me the “No name ‘Point3’ error”, while Command Prompt does not. It looks like its just a Visual Studio error, and I haven’t found a fix yet. For now, I’ll just program my code with Notepad++ and run in Command Prompt.

What did you name the file in which you typed the code?

Just main.py. I thought the script name didn’t matter in Python, only in C#/C++?

Wait, is what you’re seeing actually an error from Python, or just an error from your editor? If it’s just your editor giving you an error, then there is not really a problem, and you can just ignore that.

The name of the file doesn’t matter in principle, but if you had named it panda3d.py, then it would have conflicted with the panda3d module that ships with Panda3D.

The error im getting is an editor error, sorry for the confusion. I get the error in Visual Studio Code, not in command prompt.

That’s why I asked.

Try to import LPoint3f from panda3d.core. Does it work?