[SOLVED] Re: [BUG] ob-python :results value pp does not working

2022-01-01 Thread Christopher M. Miles

Jack Kamm  writes:

> Hi Christopher,
>
>> This might need to mentioned in Org manual and in ob-python.el source
>> code with comment. WDYT?
>
> The main documentation for this is in the Worg page for ob-python, in
> particular see the section "Return values":
>
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html
>
> I think that is the appropriate place to put this sort of documentation
> (i.e. usage of specific babel languages). However, the clarity of this
> documentation could be improved; contributions on that would be very
> welcome.
>
> In addition, this is also mentioned in the Org manual on return values
> in Org babel, "Results of Evaluation":
>
> For languages like Python, an explicit ‘return’ statement is
> mandatory when using ‘:results value’.

I see, thanks. problem solved.

-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [BUG] ob-python :results value pp does not working

2021-12-31 Thread Jack Kamm
Hi Christopher,

> This might need to mentioned in Org manual and in ob-python.el source
> code with comment. WDYT?

The main documentation for this is in the Worg page for ob-python, in
particular see the section "Return values":

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html

I think that is the appropriate place to put this sort of documentation
(i.e. usage of specific babel languages). However, the clarity of this
documentation could be improved; contributions on that would be very
welcome.

In addition, this is also mentioned in the Org manual on return values
in Org babel, "Results of Evaluation":

For languages like Python, an explicit ‘return’ statement is
mandatory when using ‘:results value’.



Re: [BUG] ob-python :results value pp does not working

2021-12-30 Thread Christopher M. Miles

Thanks Jack. Confirmed works. This might need to mentioned in Org manual and in 
ob-python.el source
code with comment. WDYT?

Jack Kamm  writes:

> For non-session Python blocks, you need to use "return" on the value, as
> if you are in a function.
>
> The following works for me:
>
> #+begin_src python :results value pp
>   dic = {'key1': 1, 'b': 2}
>   return dic
> #+end_src
>
> #+RESULTS:
> : {'b': 2, 'key1': 1}


-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [BUG] ob-python :results value pp does not working

2021-12-30 Thread Jack Kamm
For non-session Python blocks, you need to use "return" on the value, as
if you are in a function.

The following works for me:

#+begin_src python :results value pp
  dic = {'key1': 1, 'b': 2}
  return dic
#+end_src

#+RESULTS:
: {'b': 2, 'key1': 1}



[BUG] ob-python :results value pp does not working

2021-12-28 Thread Christopher M. Miles

The bellowing python source block ~:results value pp~ does not print pprint 
formated result as
expected. I tested with =$ emacs -q= confirmed this problem.

  #+begin_src python :results value pp
  dic = {'key1': 1, 'b': 2}
  dic
  #+end_src
  
  #+RESULTS[(2021-12-29 10:51:14) b1011bfee8a1636204f73e13367d3b6d2cb6a36e]:
  : None


-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [BUG] ob-python :results value pp does not working

2021-12-28 Thread Christopher M. Miles

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> The bellowing python source block ~:results value pp~ does not print pprint 
> formated result as
> expected. I tested with =$ emacs -q= confirmed this problem.
>
>   #+begin_src python :results value pp
>   dic = {'key1': 1, 'b': 2}
>   dic
>   #+end_src
>
>   
>   #+RESULTS[(2021-12-29 10:51:14) b1011bfee8a1636204f73e13367d3b6d2cb6a36e]:
>   : None

Sorry forget to fill environment information:

- Emacs version: GNU Emacs 28.0.60 (build 1, aarch64-apple-darwin20.6.0, NS 
appkit-2022.60 Version 11.6 (Build 20G165)) of 2021-10-20
- Org mode version: Org mode version 9.3.4 (release_9.3.4-644-g14d358.dirty @ 
/Users/stardiviner/Code/Emacs/org-mode/lisp/)
- System: macOS Big Sur 11.6.1
- Python: Anaconda python3 /Users/stardiviner/opt/anaconda3/bin/python

-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature