Re: [O] Division of Org documentation: Org manual and Worg
Daniele Pizzolli writes: > Done, just pushed the change succesfully! I will look forward to > integrate more docs about org-mode and python. Grazie mille! Caio -- C is for Cookie
Re: [O] Division of Org documentation: Org manual and Worg
On Wed, May 18 2016, Rasmus wrote: > Hi Daniele, > >> So... here is the patch for worg about python and utf-8! I skipped >> the part related to the tables, since I do not have a clean >> workaround. > > Thanks for contributing to Worg! > > For Worg you just need to have your ssh key added. Then you can push > changes yourself. > > http://orgmode.org/worg/worg-about.html > > You can email your public ssh key to e.g. Bastien (bzg at gnu dot org). Hello Rasmus, Done, just pushed the change succesfully! I will look forward to integrate more docs about org-mode and python. Of course feedback are welcome! Best, Daniele
Re: [O] Division of Org documentation: Org manual and Worg
On Wed, May 18 2016, Daniele Pizzolli wrote: > On Wed, May 18 2016, Rasmus wrote: > >> Daniele Pizzolli writes: >> >>> It would be nice to add them to the documentation, but I have not yet >>> figured out what is the appropriate way to send the patch! >> >> /That/ information happens to be on Worg :) >> >>http://orgmode.org/worg/org-contribute.html > > Thanks Rasmus, > > So... here is the patch for worg about python and utf-8! I skipped > the part related to the tables, since I do not have a clean > workaround. Oops, I correct a couple of typos with this one. Sorry for the noise. Daniele >From e885c2d7654dcf78cf37e5fd5b1e104545ecbd2f Mon Sep 17 00:00:00 2001 From: Daniele Pizzolli Date: Wed, 18 May 2016 11:55:00 +0200 Subject: [PATCH 1/1] Add caveats about uft-8 strings --- org-contrib/babel/languages/ob-doc-python.org | 52 ++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/org-contrib/babel/languages/ob-doc-python.org b/org-contrib/babel/languages/ob-doc-python.org index 968a8bc..8acfbff 100644 --- a/org-contrib/babel/languages/ob-doc-python.org +++ b/org-contrib/babel/languages/ob-doc-python.org @@ -25,7 +25,7 @@ #+end_html -* Template Checklist [10/12] :noexport: +* Template Checklist [11/14] :noexport: - [X] Revise #+TITLE: - [X] Indicate #+AUTHOR: - [X] Add #+EMAIL: @@ -42,6 +42,8 @@ - [ ] Describe [[Result%20Types][Result Types]] - [ ] Describe [[Other]] differences from supported languages - [X] Provide brief [[Examples%20of%20Use][Examples of Use]] + - [X] Add caveats about utf-8 in strings + - [ ] Add caveats about utf-8 in tables * Introduction Python is a high-level, readable, interpreted language which can be used for many common computing tasks. It runs on most modern @@ -242,3 +244,51 @@ return 'images/python-matplot-fig.png' # return filename to org-mode #+end_example [[file:images/python-matplot-fig.png]] + +* Caveats + +You need some care in order to pass utf-8 strings to python. + +** passing utf-8 strings to python + +#+begin_example +#+NAME: unicode_str +,#+BEGIN_EXAMPLE +“this string is not ascii!” +,#+END_EXAMPLE +#+end_example + +#+begin_example +#+NAME: error-in-passing-var +#+BEGIN_SRC python :var data=unicode_str +return data +#+END_SRC +#+end_example + +#+begin_example +#+RESULTS: error-in-passing-var +#+end_example + +Will produce no output and prints the following message in the buffer +=*Org-Babel Error Output*=: + +#+BEGIN_EXAMPLE + File "", line 3 +SyntaxError: Non-ASCII character '\xe2' in file on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details +#+END_EXAMPLE + +** passing utf-8 strings to python with workaround + +A workaround is to use =:preamble= with the value =# -*- coding:utf-8 -*-= + +#+begin_example +#+NAME: ok-in-passing-var +#+BEGIN_SRC python :preamble "# -*- coding: utf-8 -*-" :var data=unicode_str +return data +#+END_SRC +#+end_example + +#+begin_example +#+RESULTS: ok-in-passing-var +: “this string is not ascii!” +#+end_example -- 2.1.4
Re: [O] Division of Org documentation: Org manual and Worg
Hi Daniele, > So... here is the patch for worg about python and utf-8! I skipped > the part related to the tables, since I do not have a clean > workaround. Thanks for contributing to Worg! For Worg you just need to have your ssh key added. Then you can push changes yourself. http://orgmode.org/worg/worg-about.html You can email your public ssh key to e.g. Bastien (bzg at gnu dot org). Rasmus -- You people at the NSA are becoming my new best friends!
Re: [O] Division of Org documentation: Org manual and Worg
On Wed, May 18 2016, Rasmus wrote: > Daniele Pizzolli writes: > >> It would be nice to add them to the documentation, but I have not yet >> figured out what is the appropriate way to send the patch! > > /That/ information happens to be on Worg :) > >http://orgmode.org/worg/org-contribute.html Thanks Rasmus, So... here is the patch for worg about python and utf-8! I skipped the part related to the tables, since I do not have a clean workaround. Best, Daniele >From 91941d90d26e1715447fecc255d7976c0895e75d Mon Sep 17 00:00:00 2001 From: Daniele Pizzolli Date: Wed, 18 May 2016 11:55:00 +0200 Subject: [PATCH 1/1] Add caveats about uft-8 strings --- org-contrib/babel/languages/ob-doc-python.org | 52 ++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/org-contrib/babel/languages/ob-doc-python.org b/org-contrib/babel/languages/ob-doc-python.org index 968a8bc..e4619ed 100644 --- a/org-contrib/babel/languages/ob-doc-python.org +++ b/org-contrib/babel/languages/ob-doc-python.org @@ -25,7 +25,7 @@ #+end_html -* Template Checklist [10/12] :noexport: +* Template Checklist [11/14] :noexport: - [X] Revise #+TITLE: - [X] Indicate #+AUTHOR: - [X] Add #+EMAIL: @@ -42,6 +42,8 @@ - [ ] Describe [[Result%20Types][Result Types]] - [ ] Describe [[Other]] differences from supported languages - [X] Provide brief [[Examples%20of%20Use][Examples of Use]] + - [X] Add caveats about utf-8 in strings + - [ ] Add caveats about utf-8 in tables * Introduction Python is a high-level, readable, interpreted language which can be used for many common computing tasks. It runs on most modern @@ -242,3 +244,51 @@ return 'images/python-matplot-fig.png' # return filename to org-mode #+end_example [[file:images/python-matplot-fig.png]] + +* Caveats + +** passing utf-8 strings to python + +You need some care in order to pass utf-8 strings to python. + +#+begin_example +#+NAME: unicode_str +,#+BEGIN_EXAMPLE +“this string is not ascii!” +,#+END_EXAMPLE +#+end_example + +#+begin_example +#+NAME: error-in-passing-var +#+BEGIN_SRC python :var data=unicode_str +return data +#+END_SRC +#+end_example + +#+begin_example +#+RESULTS: error-in-passing-var +#+end_example + +Will produce no output and prints the following message in the buffer +=*Org-Babel Error Output*=: + +#+BEGIN_EXAMPLE + File "", line 3 +SyntaxError: Non-ASCII character '\xe2' in file on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details +#+END_EXAMPLE + +** passing utf-8 strings to python with workaround + +A workaround is to use =:preamble= with wthe value =# -*- coding:utf-8 -*-= + +#+begin_example +#+NAME: ok-in-passing-var +#+BEGIN_SRC python :preamble "# -*- coding: utf-8 -*-" :var data=unicode_str +return data +#+END_SRC +#+end_example + +#+begin_example +#+RESULTS: ok-in-passing-var +: “this string is not ascii!” +#+end_example -- 2.1.4
Re: [O] Division of Org documentation: Org manual and Worg
Daniele Pizzolli writes: > It would be nice to add them to the documentation, but I have not yet > figured out what is the appropriate way to send the patch! /That/ information happens to be on Worg :) http://orgmode.org/worg/org-contribute.html -- It was you, Jezebel, it was you
Re: [O] Division of Org documentation: Org manual and Worg
On Wed, May 18 2016, Karl Voit wrote: > Good morning William, > > * William Henney wrote: >> >> On Tue, May 17, 2016 at 9:54 AM, Karl Voit wrote: >> >>> * William Henney wrote: >>> > >>> > #+BEGIN_SRC python :python /Users/will/anaconda/envs/py27/bin/python >>> >>> Is this undocumented? http://orgmode.org/org.html does not contain >>> the string ":python:" and >>> http://orgmode.org/org.html#Language_002dspecific-header-arguments >>> also does not mention this parameter. >>> >> It is documented at >> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html >> >> You are right that it would be better if the language-specific babel >> documentation were better integrated in the general org info file. But I >> suppose nobody has been sufficiently motivated to do it yet > > That brings me to an additional question I was asking myself a > couple of times: things like this, IMHO basic features, are > sometimes mentioned in Worg but not in the Org manual. Is there a > «rule» that I can follow so that I know where to look? > > So far, I had to do full text search on both domains to find certain > keywords... Hello, Me too, and this is really a problem when you try do unusual stuff. I will share some problems and workaround for python in a new thread. It would be nice to add them to the documentation, but I have not yet figured out what is the appropriate way to send the patch! Best, Daniele
[O] Division of Org documentation: Org manual and Worg (was: Mixing Python2 and Python3 blocks in one file)
Good morning William, * William Henney wrote: > > On Tue, May 17, 2016 at 9:54 AM, Karl Voit wrote: > >> * William Henney wrote: >> > >> > #+BEGIN_SRC python :python /Users/will/anaconda/envs/py27/bin/python >> >> Is this undocumented? http://orgmode.org/org.html does not contain >> the string ":python:" and >> http://orgmode.org/org.html#Language_002dspecific-header-arguments >> also does not mention this parameter. >> > It is documented at > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html > > You are right that it would be better if the language-specific babel > documentation were better integrated in the general org info file. But I > suppose nobody has been sufficiently motivated to do it yet That brings me to an additional question I was asking myself a couple of times: things like this, IMHO basic features, are sometimes mentioned in Worg but not in the Org manual. Is there a «rule» that I can follow so that I know where to look? So far, I had to do full text search on both domains to find certain keywords... Thanks -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github