[solved] running dist error (python-ogre & py2exe)


23-01-2007 21:35:55

hey guys, i know this is a py2exe question. but was wondering whether someone knows the solution.

i get this error when i run my build app:
Traceback (most recent call last):
File "start.py", line 18, in ?
File "Listeners\Control.pyc", line 3, in ?
ImportError: dynamic module does not define init function (initOIS)

i tried renaming that .py filename just in case it locks into it instead of a needed dll. turns out im wrong.

my setup.py (for py2exe) is just really simple.


i dunno if these might help:
i'm using python 2.4 and python-ogre 0.7


24-01-2007 15:45:55

Never tried Python-Ogre with py2exe, but I will do my best to help. I have something similar to this in the past. This indicates that the module shouldn't work at all. Can you import just OIS? Python might be trying to import the wrong dll as well.

I have a request can you create a wiki page on the Python-Ogre site about this? Some like "PackagingApplictions" and then you can create a py2exe section. When this is solved it can be a guide to future users.


25-01-2007 14:23:57

This shouldn't be a python-ogre 0.7 problem, since in am able to use py2exe on it. I am using Python2.5 though..

Are you sure that py2exe could find all the required files? I don't know how you use OIS, but i use it by importing the Sampleframework module, which includes the OIS module when the Ogre version is high enough.



25-01-2007 16:10:22

i created just 2 scripts:
import OIS
from distutils.core import setup
import py2exe

nada, didn't work. i still get:
Traceback (most recent call last):
File "hello.py", line 1, in ?
ImportError: dynamic module does not define init function (initOIS)

question for scriptkid, is the sampleframework choosing to import Ogre.sf or Ogre.sf_OIS ?

tried searching for another OIS.dll in my site-packages folder, but there is only one, and it's the same thing copied to the created dist folder

btw, i'm using the released version 0.7. might that be the problem? or should i use the CVS version of python-ogre?

might it be a python-ogre problem?


25-01-2007 16:25:53

Is there anyother OIS dll? Its possible there are 2 dll's on called something like _OIS_.dll and the other called OIS.dll. When py2exe goes to work it might be trying import OIS.dll, which is the actual OIS library not its wrapper.


25-01-2007 16:27:58

oops, sorry game_ender, i just edited my previous post now. re-read it pls :oops: :oops:


25-01-2007 16:38:17

_ois_.pyd (python extension module / dll) and ois.dll (windows dll) are in the dist directory..

so you're saying that the build exe file should be importing _ois_.pyd, but instead (mysteriously) is trying to import ois.dll? hence the error?

am i getting this right? :? :?

then... what should i do? :?


25-01-2007 16:52:05

A quick hack would be to rename the OIS module, to something else like POIS and change all your imports to POIS as well. Make sure you code still works, then try py2exe again.


25-01-2007 17:08:00

ahhh. so it's the module name vs. the windows dll name. hot damn, i teh n00b. game ender ish teh 0g4r h4x0r.

thanks game_ender! it works great! seems like renaming the module folder in the site-packages IS the only solution.

i'll write a wiki entry for ya while this problem is still present.


26-01-2007 12:42:05

question for scriptkid, is the sampleframework choosing to import Ogre.sf or Ogre.sf_OIS ?

No not in the package itself, my bad. I copied & pasted the SampleFramework.py file from the Demos/Ogre directory. Sorry!


26-01-2007 14:12:03

no worries :wink: