Running packed game error.

Hi !
First, i want to tell u that my english is’nt good, so sorry for that from high. [I am from Poland, be scared :smiley:]

I do my application, speccialy:

from math import pi, sin, cos
 
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import Point3
 
class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
 
        # Disable the camera trackball controls.
        self.disableMouse()
 
        # Load the environment model.
        self.environ = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.environ.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.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.

        pandaPosInterval1 = self.pandaActor.posInterval(10,
                                                        Point3(0, -10, 0),
                                                        startPos=Point3(0, 10, 0))
        pandaPosInterval2 = self.pandaActor.posInterval(7,
                                                        Point3(0,3,0),
                                                        startPos=Point3(0,-10,0))

	pozycja3 = self.pandaActor.posInterval(5, Point3(0, 10, 0), startPos=(0, 3, 0))

        pandaHprInterval1 = self.pandaActor.hprInterval(1,
                                                        Point3(180, 0, 0),
                                                        startHpr=Point3(0, 0, 0))
        pandaHprInterval2 = self.pandaActor.hprInterval(3,
                                                        Point3(180, 0, 0),
                                                        startHpr=Point3(180, 0, 0))
	ang3 = self.pandaActor.hprInterval(2.5, (0, 0, 0), startHpr=(90, 0, 0))
 
        # Create and play the sequence that coordinates the intervals.
        self.pandaPace = Sequence(pandaPosInterval1,
                                  pandaHprInterval1,
                                  pandaPosInterval2,
                                  pandaHprInterval2,
				  pozycja3,
				  ang3,
                                  name="pandaPace")
        self.pandaPace.loop()
 
    # Define a procedure to move the camera.
    def spinCameraTask(self, task):
        angleDegrees = task.time * 20.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -20.0 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont
 
app = MyApp()
app.run()

Then i wanted to pack it to p3d., without any issueses[?]
[i packed it with models]

Then i wanted to transform it to .exe , i didnt know what was better, so i first did installer [15 minutes :O]
I was happy ! I created an installer for windows, and i installed it…
Whe i wanted to run myfirsgame.exe i saw only the black window… and app just closed…

wtf ?

when i run this code, by python code, i mean:

ppython game.py

the game is running without any problems…

i Have two versions of python on my computer: The newest [3.5] and the 2.7 on panda3d folder…
both are in PATH…

Can you tell me what i’m doing wrong ?

Hi! Welcome to the forums. We’re not afraid of Polish people, though. :slight_smile:

First of all, you should try and see if the .p3d itself runs correctly. Run it with panda3d.exe, and see if that works correctly. If that fails, then that narrows the problem down a bit more.

There should also be log files that contain more information about the failure. You should be able to find it in the directory mentioned here:
panda3d.org/manual/index.ph … _directory
Posting the log files here would help us a lot to determine the cause of your issues.

Nope, the .p3d file have this same error like .exe,

Log, for my game:

:AppRunner: Total Panda3D disk space used: 169 MB
:AppRunner: Configured max usage is: 2048 MB
:display: loading display module: libpandagl.dll
:display: loading display module: libpandadx9.dll
:display: loading display module: libpandadx8.dll
:display: loading display module: libp3tinydisplay.dll
Known pipe types:
  wglGraphicsPipe
  wdxGraphicsPipe9
  wdxGraphicsPipe8
  TinyWinGraphicsPipe
  TinyOffscreenGraphicsPipe
(all display modules loaded.)
:display:windisplay: OS version: 6.1.2.7600 
:display:windisplay:   
:display:windisplay: max Mhz 598000000, current Mhz 598000000 
:ShowBase: Default graphics pipe is wglGraphicsPipe (OpenGL).
:display:gsg:glgsg(warning): BlendEquation advertised as supported by OpenGL runtime, but could not get pointers to extension function.
:display:gsg:glgsg(warning): BlendColor advertised as supported by OpenGL runtime, but could not get pointers to extension function.
:display: Created output of type wglGraphicsWindow
:display: Unable to set window properties: !undecorated !fixed_size 
:ShowBase: Successfully opened window of type wglGraphicsWindow (OpenGL)
:audio: NullAudioManager
:audio: NullAudioManager
:ShowBase: __dev__ == False
:loader(error): Couldn't load file models/environment.bam: not found on model path (currently: "/c/Users/gtteam/AppData/Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/panda3d/cmu_1.8;/c/Users/gtteam/AppData/Local/Panda3D/start")
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\AppRunner.py", line 748, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "C:\Users\gtteam\Desktop\python\python.py", line 73, in <module>
    app = MyApp()
  File "C:\Users\gtteam\Desktop\python\python.py", line 17, in __init__
    self.environ = self.loader.loadModel("models/environment")
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Loader.py", line 170, in loadModel
IOError: Could not load model file(s): ['models/environment']
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\AppRunner.py", line 638, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\Task.py", line 502, in run
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\task\Task.py", line 460, in step
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 424, in __taskChainDispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Messenger.py", line 482, in __dispatch
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\p3d\AppRunner.py", line 748, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "C:\Users\gtteam\Desktop\python\python.py", line 73, in <module>
    app = MyApp()
  File "C:\Users\gtteam\Desktop\python\python.py", line 17, in __init__
    self.environ = self.loader.loadModel("models/environment")
  File "C:\buildslave\release_rtdist_win32\build\panda3d\built_cmu\direct\showbase\Loader.py", line 170, in loadModel
IOError: Could not load model file(s): ['models/environment']
:TaskManager: TaskManager.destroy()
:display: Closing wglGraphicsWindow
Failure on startup.
ct
notify: onpythonload 
Downloading https://runtime.panda3d.org/contents.xml?1425035836: 22.3%, 01778AB0
Downloaded https://runtime.panda3d.org/contents.xml?1425035836: 100%, 01778AB0, success = 1
release_temp_filename: C:\Users\gtteam\AppData\Local\Temp\p3d_9bcb0b.xml
All 8 extracts of images seem good.
report_package_info_ready: images
Done installing images: success = 1
image_filename = C:\Users\gtteam\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png, thread_id = 2448
Loaded image: C:\Users\gtteam\AppData\Local/Panda3D/hosts/runtime.panda3d.org_0f5faf88846080ae/images/download.png
notify: onpythonstop 
finish_instance: 01776DD0
Assigning 01776DD0->log_pathname = C:\Users\gtteam\AppData\Local/Panda3D/log/pandagame.log

[size=85]




[/size]

You are using the built-in models, and need to use “-r models” on the packp3d command-line to include those.

this same…
(log in second picture)


Hmm, that’s supposed to work. Out of curiosity, does it work if you change “models/environment” to just “environment” in the loader.loadModel command?

Yep, this was a reason, i deleted all “models/” path, so now it works, ; > Thanks for answering man, i love u :slight_smile:
The standalone exe file works too, so i go coding and teaching myself. Hope to see u again, greattings form Poland :slight_smile:
[It sounds like saying goodbye for all time :smiley:]

Or you could be more organized and make a models subfolder inside your folder that you’re going to pack, then you can keep “models/environment”. I did see in the error that the path to the model was invalid. If I were you, I would be more organized and keep my models in their own folder (a models folder).

The reason you were getting the error is because the model was in the same directory as the py file. So, when you load the model with loader.loadModel(“models/environment”) it’s going to look for a subfolder in the same directory called “models”, and if it finds it, it will then look for “environment” in that subfolder. In your case, you put your environment model in the same directory as your py file, and you were searching for a models folder at the same time, but it doesn’t exist. Basically, you told it to search for a models folder with the environment model file inside it.