Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve absolute import management for iptest.py #60

Closed
ipython opened this issue May 10, 2010 · 1 comment
Closed

Improve absolute import management for iptest.py #60

ipython opened this issue May 10, 2010 · 1 comment
Milestone

Comments

@ipython
Copy link
Collaborator

ipython commented May 10, 2010

Original Launchpad bug 506112: https://bugs.launchpad.net/ipython/+bug/506112
Reported by: fdo.perez (Fernando Perez).

On Mon, Jan 11, 2010 at 11:36 AM, Jörgen Stenarson jorgen.stenarson@bostream.nu wrote:

I often run IPython/testing/iptest.py as a script but this is not possible
now due to a relative import:

> C:\python\external\ipython-perez\IPython>python testing\iptest.py
> Traceback (most recent call last):
>  File "testing\iptest.py", line 39, in 
>    from . import globalipapp
> ValueError: Attempted relative import in non-package

Argh, yes. This is unfortunately only fixed for 2.6:

http://www.python.org/dev/peps/pep-0366/

We might just add that boilerplate

if __name__ == "__main__" and __package__ is None:
    __package__ = "expected.package.name"

protected by a version check, so your approach continues to work.

@fperez
Copy link
Member

fperez commented Mar 23, 2011

This is now fixed in master, closing.

@fperez fperez closed this as completed Mar 23, 2011
minrk pushed a commit to minrk/ipython that referenced this issue Jul 1, 2013
Some enhancements of the latex export option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant