1

I am compiling IronPython scripts into EXE file by referring to: IronPython - how to compile exe

It is working fine if all the IronPython scripts are located in the same folder. However, if I have IronPython script in different folder, I will receive an import error message when I import them.

For example, this is my file structure:

/MyIronPythonProject
   /util
       /generic.py
       /__init__.py
   /main.py

And in my main.py, i import generic.py:

import util.generic
a = generic.somemethod()

Do you have any idea about this issue? Please advice. Thanks.

BendEg
  • 20,098
  • 17
  • 57
  • 131
  • Are `generic.py` and `__init__.py` in a directory named `generic`? I do not totally get your folder/directory structure. – BendEg Nov 14 '15 at 21:36
  • Hi BendEg, `__init__.py` and `generic.py` are located in "util" folder. Meanwhile, both "util" folder and `main.py` are located in "MyIronPythonProject" folder. – thisiswilson Jan 05 '16 at 07:14
  • If you use `import util.generic`, you should also call the method like this: `a = util.generic.somemethod()`. Please try this. Is your `__init__.py` empty? – BendEg Jan 05 '16 at 07:36
  • Hi BendEg, yes, my `__init__.py` is empty. – thisiswilson May 25 '16 at 05:52
  • are you able to post the exact error message? Maybe attaching some debugger helps. But for this you need to clone the offcial reository from github and maybe compile your own version (very simple). – BendEg May 25 '16 at 10:44

0 Answers0