1

I am trying to run my python3 code distributable, with a single executable, mostly in Linux and mac system.

My file structure is:

mkbib
├── main.py
├── menubar.ui
├── menu.py
├── mkbib.svg
├── pybib.py
├── __pycache__
│   ├── main.cpython-34.pyc
│   ├── menu.cpython-34.pyc
│   ├── pybib.cpython-34.pyc
│   └── view.cpython-34.pyc
└── view.py
setup.py [error opening dir]

This runs fine with

$python3 main.py

But, as I was trying to setup setup.py(comment in this Q) I come to realize that, I should run it using

python3 -m mkbib.main

(not exactly sure why), but when I try this, I am getting error:

python3 -m mkbib.main
Traceback (most recent call last):
  File "/usr/lib64/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/rudra/Devel/mkbib/Python/mkbib/main.py", line 3, in <module>
    import menu
ImportError: No module named 'menu'

Is this a basic problem with the code itself? Or I need to follow few things that I am missing?

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
BaRud
  • 3,055
  • 7
  • 41
  • 89
  • In the comment from mata in the other/same question, there is more to it than just adding a `-m mkbib.main`. Maybe continue in the same question since this looks like a continuation of the same problem? And take a look at http://stackoverflow.com/questions/15746675/how-to-write-a-python-module – oystein-hr Feb 26 '16 at 14:28
  • Hi, This is indeed continuation of the same question(thats why I cited that ), but I was thinking of coming back to that question when I am actually creating the `setup.py`. Here, I am discussing the compilation from command line, without `setup.py`. So, in my opinion, its better to keep these two separate(though, indeed, they are linked). – BaRud Feb 26 '16 at 14:33

0 Answers0