Arash
Arash

Reputation: 13

I have a problem with ursina when it gets compiled to an exe file

I started creating a shooter game with ursina, and I tried to get exe from this using pyinstaller. After I got the exe, when I run the app, it shows me an error:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
  File "ursina\main.py", line 28, in __init__
  File "direct\showbase\ShowBase.py", line 339, in __init__
  File "direct\showbase\ShowBase.py", line 1024, in openDefaultWindow
  File "direct\showbase\ShowBase.py", line 1059, in openMainWindow
  File "direct\showbase\ShowBase.py", line 769, in openWindow
  File "direct\showbase\ShowBase.py", line 749, in <lambda>
  File "direct\showbase\ShowBase.py", line 821, in _doOpenWindow
  File "direct\showbase\ShowBase.py", line 650, in makeDefaultPipe
  File "direct\directnotify\Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

my code:

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from ursina.shaders import lit_with_shadows_shader

app = Ursina()

ground = Entity(model='plane', collider='box', scale=64, texture='grass', texture_scale=(4,4))

editor_camera = EditorCamera(enabled=False, ignore_paused=True)
player = FirstPersonController()

for i in range(16):
    Entity(model='cube', origin_y=-.5, scale=2, texture='brick', texture_scale=(1,2),
        x=random.uniform(-8,8),
        z=random.uniform(-8,8) + 8,
        collider='box',
        scale_y = random.uniform(2,3),
        color=color.hsv(0, 0, random.uniform(.9, 1))
        )

cube = Entity(model='cube',color=color.red,scale=3)

def update():
    cube.rotation_x = cube.rotation_x + 15
    cube.rotation_y = cube.rotation_y + 5


# Enemy()

sun = DirectionalLight()
sun.look_at(Vec3(1,-1,-1))
Sky()

app.run()

I have checked and there is no Config.prc file here.

Upvotes: 1

Views: 868

Answers (1)

Arash
Arash

Reputation: 13

To build it, you need to open a terminal and type in:

$ python -m ursina.build

And when you do, this will create a folder called "build". You have to then open that folder up and run the "PROJECTNAME.BAT" file, whereas project name is equal to your project's directory.

Upvotes: 1

Related Questions