Hi all,
first of I would like to say that the distribution system of Panda3D is really cool.
Inspired by markjacksonguy’s postings about it I started fiddling around with it.
I’ve made a ‘simple’ test app:
The directory structure is as follows:
HelloApp/HelloWorld.py
HelloApp/codebase
HelloApp/codebase/init.py
HelloApp/codebase/fibo.py
HelloWorld.py:
import sys
from ctypes import windll
from codebase.fibo import *
def main(arg):
print(arg)
print("Hello World")
print("fibo")
fib(5)
print("*"*20)
print(windll.user32.MessageBoxA(None, "MessageBox Text", "MyBox", 0))
# windll.user32
sys.exit(0)
codebase/init.py
print('__name__=', __name__, '__package__=', __package__)
codebase/fibo.py
# Fibonacci numbers module
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result
For some reason the print statement doesn’t get called and if I look into the p3d with multify -tvf myapp.p3d I see that an init directory was created.
656 43% Jun 11 18:52 HelloWorld.pyo
95 31% Jun 11 18:52 codebase/__init__.pyo
225 25% Jun 11 18:52 codebase/__init__/__init__.pyo
681 52% Jun 11 18:52 codebase/fibo.pyo
383 Jun 11 18:52 p3d_info.xml
Why is that? I guess I miss something about python packages …
If I run the HelloWorld.py directly the print statement works fine.
Greetings and thanks!
Revington
Edit:
I used morepy etc and the call to MessageBoxA(None, “MessageBox Text”, “MyBox”, 0) works fine - I also don’t see anything wrong in the panda3d logs.
It’s just that the init.py for some reason will not work.
HelloApp.7z (591 Bytes)