all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug in 8.2.5f for using tables as data in python?
@ 2014-01-22  2:33 John Kitchin
  2014-01-22  4:52 ` Nick Dokos
       [not found] ` <1390394132.49030.YahooMailNeo@web171302.mail.ir2.yahoo.com>
  0 siblings, 2 replies; 7+ messages in thread
From: John Kitchin @ 2014-01-22  2:33 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]

Hi all,

I am having a problem in 8.2.5 using a table as a data source for a python
block. I get this particular error: org-babel-python-var-to-python: Wrong
type argument: stringp, 1
It seems to be that the 1 is not a string, but a number.

Here is what I have to reproduce the problem. the table works fine for an
emacs-lisp block.


#+BEGIN_SRC emacs-lisp :results value
(org-version)
#+END_SRC

#+RESULTS:
: 8.2.5f

#+BEGIN_SRC python
print 6
#+END_SRC

#+RESULTS:
: 6

#+tblname: data
| a | b |
|---+---|
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |

#+BEGIN_SRC emacs-lisp :var tt=data
(princ tt)
#+END_SRC

#+RESULTS:
: ((1 2) (3 4) (5 6))

#+BEGIN_SRC python :var tt=data
print tt
#+END_SRC

executing Python code block...
org-babel-python-var-to-python: Wrong type argument: stringp, 1

Does anyone else see this?


John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 1402 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
  2014-01-22  2:33 bug in 8.2.5f for using tables as data in python? John Kitchin
@ 2014-01-22  4:52 ` Nick Dokos
       [not found] ` <1390394132.49030.YahooMailNeo@web171302.mail.ir2.yahoo.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2014-01-22  4:52 UTC (permalink / raw)
  To: emacs-orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Does anyone else see this?
>

Yes. I seem to have different default header args (e.g. :results value
rather than :results output for the first python block and the table
gets printed out as a table, not as a lisp list, for the elisp block)
but the last python block gives me the same error.

-- 
Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
       [not found] ` <1390394132.49030.YahooMailNeo@web171302.mail.ir2.yahoo.com>
@ 2014-01-22 12:41   ` Miguel Ruiz
  2014-01-22 14:22     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ruiz @ 2014-01-22 12:41 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]



Could it be a poorly rewritten patch? Original Daniel Gerber's proposal works for me.


diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 1457682..523fd70 100644 (file)
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -137,7 +137,7 @@ specifying a variable of the same value."
        org-babel-python-hline-to
       (format
        (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
-       var))))
+       (substring-no-properties var)))))
 
 (defun org-babel-python-table-or-string (results)
   "Convert RESULTS into an appropriate elisp
 value.


vs


http://lists.gnu.org/archive/html/emacs-orgmode/2014-01/msg00286.html
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 1457682..baa5764 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -137,7 +137,7 @@ specifying a variable of the same value."
        org-babel-python-hline-to
       (format

(if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")

-       var))))
+       (if (stringp var) (substring-no-properties var) var)))))

 (defun org-babel-python-table-or-string (results)
   "Convert RESULTS into an appropriate elisp value.


Miguel.

[-- Attachment #2: Type: text/html, Size: 2984 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
  2014-01-22 12:41   ` Miguel Ruiz
@ 2014-01-22 14:22     ` Bastien
  2014-01-22 15:58       ` Miguel Ruiz
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-01-22 14:22 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode@gnu.org

Hi Miguel,

Miguel Ruiz <rbenit68@yahoo.es> writes:

> Could it be a poorly rewritten patch? Original Daniel Gerber's
> proposal works for me.

Can you tell what's wrong in the current version of ob-python.el
from git repo?  Otherwise I'm not sure to understand.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
  2014-01-22 14:22     ` Bastien
@ 2014-01-22 15:58       ` Miguel Ruiz
  2014-01-22 16:11         ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ruiz @ 2014-01-22 15:58 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]

Sorry, Bastien

At this moment, in ob-python.el you can see:


(defun org-babel-python-var-to-python (var) "Convert an elisp value to a python variable.
Convert an elisp value, VAR, into a string of python source code
specifying a variable of the same value." (if (listp var) (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]") (if (equal var 'hline) org-babel-python-hline-to (format (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S") (substring-no-properties var)))))
But I understand that Daniel Gerber's proposal is (note the last line):


(defun org-babel-python-var-to-python (var) "Convert an elisp value to a python variable.
Convert an elisp value, VAR, into a string of python source code
specifying a variable of the same value." (if (listp var) (concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]") (if (equal var 'hline) org-babel-python-hline-to (format (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S") (if (stringp var) (substring-no-properties var) var)))))

And, related to the problem of the OP, this last code works for me.

Miguel




El Miércoles 22 de enero de 2014 15:23, Bastien <bzg@gnu.org> escribió:
 
Hi Miguel,


Miguel Ruiz <rbenit68@yahoo.es> writes:

> Could it be a poorly rewritten patch? Original Daniel Gerber's
> proposal works for me.

Can you tell what's wrong in the current version of ob-python.el
from git repo?  Otherwise I'm not sure to understand.

Thanks,

-- 
Bastien

[-- Attachment #2: Type: text/html, Size: 2664 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
  2014-01-22 15:58       ` Miguel Ruiz
@ 2014-01-22 16:11         ` Bastien
  2014-01-22 16:39           ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2014-01-22 16:11 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode@gnu.org

Miguel Ruiz <rbenit68@yahoo.es> writes:

> But I understand that Daniel Gerber's proposal is (note the last
> line):

Got it now.  Fixed, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug in 8.2.5f for using tables as data in python?
  2014-01-22 16:11         ` Bastien
@ 2014-01-22 16:39           ` John Kitchin
  0 siblings, 0 replies; 7+ messages in thread
From: John Kitchin @ 2014-01-22 16:39 UTC (permalink / raw)
  To: Bastien; +Cc: Miguel Ruiz, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

Confirmed. I just pulled the latest repository and it is fixed! Hooray, now
to finish exporting the manuscript I am trying to resubmit!

John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Wed, Jan 22, 2014 at 11:11 AM, Bastien <bzg@gnu.org> wrote:

> Miguel Ruiz <rbenit68@yahoo.es> writes:
>
> > But I understand that Daniel Gerber's proposal is (note the last
> > line):
>
> Got it now.  Fixed, thanks!
>
> --
>  Bastien
>
>

[-- Attachment #2: Type: text/html, Size: 1199 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-22 16:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22  2:33 bug in 8.2.5f for using tables as data in python? John Kitchin
2014-01-22  4:52 ` Nick Dokos
     [not found] ` <1390394132.49030.YahooMailNeo@web171302.mail.ir2.yahoo.com>
2014-01-22 12:41   ` Miguel Ruiz
2014-01-22 14:22     ` Bastien
2014-01-22 15:58       ` Miguel Ruiz
2014-01-22 16:11         ` Bastien
2014-01-22 16:39           ` John Kitchin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.