Hi Eric,
thanks you so much for always being so responsive to my silly questions :)
I apologize, I wrote that mail 2 am after fiddling around with that problem for about 3 hours.
Trying to reduce the problem to a minimal example, I almost built in stupid errors.
I was holding back to send examples as org-file attachment because I believe that attachments can't be parsed by the different mailing list archives and thus, any infos there are not searchable. However, I guess in the future I will simple paste the example and attach a org-file (which in turn I can really test before sending).
Ok back on track. My problem seems to be quite strange. It is not exactly related to babel but more about the interface babel + python. Taking your example, I modified it to reflect my problem
//-------------------------- content of table-calls.org--------------------------------------------------------
#+TBLNAME: tablename
| | Name | StudentID | 1.1 | 1.2 | 1.3 | 1.4 | 2.1 | 2.2 | 2.3 | 2.4 | 2.5 | Sum 1 | Sum 2 | Total Sum | Mark | Remark |
|---+------+-----------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-------+-------+-----------+------+--------|
| # | Mr A | 11111 | 0 | 12 | 0 | 0 | 17 | 8 | 10 | 0 | 0 | 12 | 35 | 47 | 5 | |
| # | Ms B | 22222 | 1 | 2 | 3 | 4 | 5 | 2 | 3 | 4 | 5 | 10 | 19 | 29 | 5 | second |
I have the following code block
#+name: test
#+begin_src python :var table=tablename :exports results
return type(table[1])
#+end_src
#+RESULTS: test
: <class 'list'>
If I call that function the result is correct
However using
#+CALL: test[:var table=tablename]() :exports results
#+RESULTS: test[:var table=tablename]():exports results
: <class 'NoneType'>
#+CALL: test(table=tablename) :exports results
#+RESULTS: test(table=tablename):exports results
: <class 'NoneType'>
// ------------------------------------------------------end----------------------------------------------------------------
I think I get a bit further with the trouble shooting. As you can see, the problem seems to be
Calling the source code block directly table seems to be of type list which is (I guess) correct
However, calling the code via a #+CALL line, the input data (table) is of type 'NoneType'.
This hoax the later operation in a very strange way. E.g. plan return of the table is fine, even table[i] works,
more complex operations don't.
The question for me is, why is there a difference of the data (table) type depending on the call?
As for the second part of the email, again sorry I was kind of tired.
Take I have this property drawer
*** Exam evaluation :intern:
:PROPERTIES:
:passscore: 50
:extrapoints: 1
:END:
and within a table formula line e.g.
'(sbe score2mark (score $15) (passscore "$PROP_passscore")
This works well, now I want to use the same property as value of a source code block
Those fail:
#+CALL: createscoretable(passscore=passscore) :exports results
#+CALL: createscoretable(passscore) :exports results
#+CALL: createscoretable($PROP_passscore) :exports results
#+CALL: createscoretable(passscore=$PROPpassscore) :exports results
I can see how to assign a property defined variable to a code block call.
I tried modifications like
*** Exam evaluation :intern:
:PROPERTIES:
:var: passscore=50
:extrapoints: 1
:END:
and
#+PROPERTY: var passscore=50
But none of them seem to work for me. Even if one work, would it work together with the way sbe calls property values?
Basically, I want to use a variable defined in a Property-Drawer for both the sbe function within table formulars and as value for functions calls of source code blocks
Thanks again for all your help!
All the best
Torsten