PYTHONPATH and module names

SpaghettiToastBook . spaghettitoastbook at gmail.com
Mon Jul 1 16:40:03 EDT 2013


Relative imports only work with the "from ... import ..." form.

— SpaghettiToastBook


On Mon, Jul 1, 2013 at 3:54 PM, Tobiah <toby at tobiah.org> wrote:
>> Are you familiar with absolute and relative imports:
>> http://docs.python.org/release/2.5/whatsnew/pep-328.html
>
>
> Doesn't seem to work:
>
> Python 2.7.3 (default, May 10 2012, 13:31:18)
> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from __future__ import absolute_import
>>>> import .format
>   File "<stdin>", line 1
>     import .format
>            ^
> SyntaxError: invalid syntax
>>>>
>
> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list