From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Stansell Subject: Bug: python code block single import line [9.0.9 (release_9.0.9-754-g940c90)] Date: Mon, 14 Aug 2017 00:42:11 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c03ba66ca023f0556ab1adb" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dh2X1-0003xy-GY for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 19:42:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dh2Wz-0004zy-W5 for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 19:42:55 -0400 Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:37982) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dh2Wz-0004zi-Nv for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 19:42:53 -0400 Received: by mail-pg0-x22e.google.com with SMTP id l64so35560133pge.5 for ; Sun, 13 Aug 2017 16:42:53 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --94eb2c03ba66ca023f0556ab1adb Content-Type: text/plain; charset="UTF-8" Hello, When executing the python code block #+begin_src python :session python1 import numpy as np #+end_src I get this error in my python buffer Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> >>> import numpy as np >>> open('/tmp/babel-5320QCO/python-5320y31', 'w').write(str(_)) 'org_babel_python_eoe' >>> >>> Traceback (most recent call last): File "", line 1, in NameError: name '_' is not defined >>> >>> >>> 'org_babel_python_eoe' >>> However, the following code block does not give an error: #+begin_src python :session python2 import numpy as np 1 #+end_src Thanks, Paul Emacs : GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23) of 2015-08-26 on localhost.localdomain Package: Org mode version 9.0.9 (release_9.0.9-754-g940c90) current state: ============== (setq org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-occur-hook '(org-first-headline-recenter) org-metaup-hook '(org-babel-load-in-session-maybe) org-confirm-shell-link-function 'yes-or-no-p org-after-todo-state-change-hook '(org-clock-out-if-current) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5 "\n\n(fn)"] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5 "\n\n(fn)"] org-babel-result-hide-spec org-babel-hide-all-hashes) org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-archive-hook '(org-attach-archive-delete-maybe) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el")) org-confirm-elisp-link-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-link-parameters '(("id" :follow org-id-open) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs") ("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link) ("file" :complete org-file-complete-link) ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path)))) ("help" :follow org--open-help-link) ("http" :follow (lambda (path) (browse-url (concat "http:" path)))) ("https" :follow (lambda (path) (browse-url (concat "https:" path)))) ("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path)))) ("news" :follow (lambda (path) (browse-url (concat "news:" path)))) ("shell" :follow org--open-shell-link)) org-babel-load-languages '((python . t)) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) ) --94eb2c03ba66ca023f0556ab1adb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,
=
When executing the python code block

=C2=A0 #+begin_src python := session python1
=C2=A0 =C2=A0 import numpy as np
=C2=A0 #+end_src
=
I get this error in my python buffer

=C2=A0 Python 3.5.1 |Anacon= da 2.5.0 (64-bit)| (default, Dec =C2=A07 2015, 11:16:01)
=C2=A0 [GCC 4.4= .7 20120313 (Red Hat 4.4.7-1)] on linux
=C2=A0 Type "help", &q= uot;copyright", "credits" or "license" for more in= formation.
=C2=A0 >>> >>> >>> import numpy as= np
=C2=A0 >>>
=C2=A0 open('/tmp/babel-5320QCO/python-53= 20y31', 'w').write(str(_))
=C2=A0
=C2=A0
=C2=A0 'o= rg_babel_python_eoe'
=C2=A0 >>> >>> Traceback (mos= t recent call last):
=C2=A0 =C2=A0 File "<stdin>", line = 1, in <module>
=C2=A0 NameError: name '_' is not defined=C2=A0 >>> >>> >>> 'org_babel_python_eoe&#= 39;
=C2=A0 >>>

However, the following code block does no= t give an error:

=C2=A0 #+begin_src python :session python2
=C2= =A0 =C2=A0 import numpy as np
=C2=A0 =C2=A0 1
=C2=A0 #+end_src

Thanks,

Paul


Emacs =C2=A0: GNU Emacs 24.5.1 (x86_64-= redhat-linux-gnu, GTK+ Version 2.24.23)
=C2=A0of 2015-08-26 on localhost= .localdomain
Package: Org mode version 9.0.9 (release_9.0.9-754-g940c90)=

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(se= tq
=C2=A0org-tab-first-hook '(org-babel-hide-result-toggle-maybe org= -babel-header-arg-expand)
=C2=A0org-speed-command-hook '(org-speed-c= ommand-activate org-babel-speed-command-activate)
=C2=A0org-occur-hook &= #39;(org-first-headline-recenter)
=C2=A0org-metaup-hook '(org-babel-= load-in-session-maybe)
=C2=A0org-confirm-shell-link-function 'yes-or= -no-p
=C2=A0org-after-todo-state-change-hook '(org-clock-out-if-curr= ent)
=C2=A0org-src-mode-hook '(org-src-babel-configure-edit-buffer o= rg-src-mode-configure-edit-buffer)
=C2=A0org-agenda-before-write-hook &#= 39;(org-agenda-add-entry-text)
=C2=A0org-babel-pre-tangle-hook '(sav= e-buffer)
=C2=A0org-mode-hook '(#[0 "\300\301\302\303\304$\207&= quot;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[add-hook change-major-mo= de-hook org-show-block-all append local] 5
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0"\n\n(fn)"]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#[0= "\300\301\302\303\304$\207"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0[add-hook change-major-mode-hook org-babel-show-result-all append= local] 5
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"\n\n(fn)"]=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0org-babel-result-hide-spec org-babel-= hide-all-hashes)
=C2=A0org-bibtex-headline-format-function #[257 "\= 300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"]
=C2=A0org-arc= hive-hook '(org-attach-archive-delete-maybe)
=C2=A0org-cycle-hook &#= 39;(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 org-cycle-show-empty-lines org-optimize-window-aft= er-visibility-change)
=C2=A0org-babel-tangle-lang-exts '(("pyth= on" . "py") ("emacs-lisp" . "el") ("= ;elisp" . "el"))
=C2=A0org-confirm-elisp-link-function &#= 39;yes-or-no-p
=C2=A0org-metadown-hook '(org-babel-pop-to-session-ma= ybe)
=C2=A0org-link-parameters '(("id" :follow org-id-open= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("rmail&qu= ot; :follow org-rmail-open :store org-rmail-store-link)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("mhe" :follow org-mhe-o= pen :store org-mhe-store-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0("irc" :follow org-irc-visit :store org-irc-store-l= ink)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("info&= quot; :follow org-info-open :export org-info-export :store
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-info-store-link)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("gnus" :follow org-gnus-open := store org-gnus-store-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0("docview" :follow org-docview-open :export org-docview= -export :store
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 org-docview-sto= re-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("b= ibtex" :follow org-bibtex-open :store org-bibtex-store-link)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("bbdb" :follow = org-bbdb-open :export org-bbdb-export :complete
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 org-bbdb-complete-link :store org-bbdb-store-link)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("w3m" :store= org-w3m-store-link) ("file+sys") ("file+emacs")
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("doi" :follo= w org--open-doi-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0("elisp" :follow org--open-elisp-link)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("file" :complete org-file-= complete-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(&= quot;ftp" :follow (lambda (path) (browse-url (concat "ftp:" = path))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("h= elp" :follow org--open-help-link)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0("http" :follow (lambda (path) (browse-ur= l (concat "http:" path))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0("https" :follow (lambda (path) (browse-url (= concat "https:" path))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0("mailto" :follow (lambda (path) (browse-url = (concat "mailto:" path))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0("news" :follow (lambda (path) (browse-url (c= oncat "news:" path))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0("shell" :follow org--open-shell-link))
=C2= =A0org-babel-load-languages '((python . t))
=C2=A0org-clock-out-hook= '(org-clock-remove-empty-clock-drawer)
=C2=A0)
--94eb2c03ba66ca023f0556ab1adb--