GNU bug report logs - #13570
24.2; (python.el) "ValueError: Attempted relative import in non-package" with relative import.

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Sun, 27 Jan 2013 22:41:01 UTC

Severity: normal

Fixed in version 24.2

Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
Cc: tracker <at> debbugs.gnu.org
Subject: bug#13570: closed (24.2; (python.el) "ValueError: Attempted
 relative import in non-package" with relative import.)
Date: Sun, 27 Jul 2014 06:42:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 27 Jul 2014 03:41:52 -0300
with message-id <87wqaze21b.fsf <at> gnu.org>
and subject line 24.2; (python.el) "ValueError: Attempted relative import in non-package" with relative import.
has caused the debbugs.gnu.org bug report #13570,
regarding 24.2; (python.el) "ValueError: Attempted relative import in non-package" with relative import.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
13570: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13570
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2;
	(python.el) "ValueError: Attempted relative import in non-package"
	with relative import.
Date: Mon, 28 Jan 2013 00:40:20 +0200
In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-01-21 on trouble, modified by Debian

  # mkdir package
  # cd package

  # cat <<EOF >cmd.py
  from . import lib
  lib.ok()
  EOF

  # cat <<EOF >lib.py
  def ok():
      print('ok')
  EOF

When you open cmd.py and try C-c C-l (python-load-file) you get:

  >>> Traceback (most recent call last):
  Traceback (most recent call last):
    File "/home/user/devel/tmp/package/cmd.py", line 1, in <module>
      from . import lib
  ValueError: Attempted relative import in non-package

With C-c C-c (python-send-string) ever worse: it uses (make-temp-file "py") so
relative import is not possible!!

-- 
Best regards!


[Message part 3 (message/rfc822, inline)]
From: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
To: 13570-done <at> debbugs.gnu.org
Subject: 24.2;
 (python.el) "ValueError: Attempted relative import in non-package"
 with relative import.
Date: Sun, 27 Jul 2014 03:41:52 -0300
Fixed at revno 117584 in trunk.

The new `python-shell-package-enable' command let's you enable a package
for the current shell and use relative imports in evaled code.


Cheers,
Fabián


This bug report was last modified 10 years and 360 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.