Python Nose Import Error

You’ve got an __init__.py in your top level directory. That makes it a package. If you remove it, your nosetests should work. If you don’t remove it, you’ll have to change your import to import dir.foo, where dir is the name of your directory.

When to use os.name, sys.platform, or platform.system?

Dived a bit into the source code. The output of sys.platform and os.name are determined at compile time. platform.system() determines the system type at run time. sys.platform is specified as a compiler define during the build configuration. os.name checks whether certain os specific modules are available (e.g. posix, nt, …) platform.system() actually runs uname and … Read more

What does from __future__ import absolute_import actually do?

The changelog is sloppily worded. from __future__ import absolute_import does not care about whether something is part of the standard library, and import string will not always give you the standard-library module with absolute imports on. from __future__ import absolute_import means that if you import string, Python will always look for a top-level string module, … Read more