Fix Python – In Python, can I call the main() of an imported module?

In Python I have a module where I define a few functions and a main(), which takes a few command line arguments.
I usually call this main() from a bash script. Now, I would like to put everything into a small package, so I thought that maybe I could turn my simple bash script into a Python script and put it in the package.
So, how do ….

Fix Python – Whats the difference between a module and a library in Python?

I have background in Java and I am new to Python. I want to make sure I understand correctly Python terminology before I go ahead.
My understanding of a module is: a script which can be imported by many scripts, to make reading easier. Just like in java you have a class, and that class can be imported by many other classes.
My understanding of a l….

Fix Python – Python module with a dash, or hyphen (-) in its name

I have an existing python module with a dash in its name,
Changing the module name is something I would prefer to avoid as the module is shared, and I would have to chase down all the places it is used so that my special case will work.
Is there a way to load a module whose name contains the typically forbidden ‘-‘?
(I do understand tha….

Fix Python – What is the most compatible way to install python modules on a Mac?

I’m starting to learn python and loving it. I work on a Mac mainly as well as Linux. I’m finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can import it with no trouble.
On the Mac, I’m used to using Macports to install all the Unixy stuff. However, I’m finding that most of the python modules ….

Fix Python – How to make a cross-module variable?

The __debug__ variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?
The variable (let’s be original and call it ‘foo’) doesn’t have to be truly global, in the sense that if I change foo in one module, it is updated in others. I’d be fine if I could set foo before….

Fix Python – Is there a standard way to list names of Python modules in a package?

Is there a straightforward way to list the names of all modules in a package, without using __all__?
For example, given this package:

I’m wondering if there is a standard or built-in way to do something like this:
>>> package_contents(“testpkg”)
[‘modulea’, ‘moduleb’]

The manu….

Fix Python – ImportError: No module named six

I’m trying to build OpenERP project, done with dependencies. It’s giving this error now
Traceback (most recent call last):
File “”, line 105, in
File “modules\__init__.pyo”, line 23, in
File “modules\gui\__init__.pyo”, line 22, in
File “modules\gui\main.pyo”, line 33, in
File “rpc.pyo”….