Menu

fix for treating local variables as argument; container type from a python function; version 2.0.1

2014-08-07
2014-08-18
  • Dani Budinova

    Dani Budinova - 2014-08-07

    Hello,

    I changed init.py, line 10:
    for vname in f.code.co_varnames[:f.code.co_argcount]:

    to fix treating local variables as argument.
    How can I receive any container type from a python function?

    BR,
    Dani

     
    • Eric Reynolds

      Eric Reynolds - 2014-08-07

      Excellent thanks for that.

      Can you explain better what you mean by "receive any container type from a python function"?

       

      Last edit: Eric Reynolds 2014-08-07
  • Dani Budinova

    Dani Budinova - 2014-08-08

    Hi Eric,

    I'm trying to write a python function with arguments like ranges and sheets. The output i need is a dictionary or other structure. How can i deal with this function's return?
    Actually i need to return rows. May be an example with sorting rows and place the result on different sheet is enough.

    Thanks.

     

    Last edit: Dani Budinova 2014-08-08
    • Eric Reynolds

      Eric Reynolds - 2014-08-08

      Ok, so you can't save a dictionary value in a cell so you need to represent
      it somehow. One idea could be to convert the return value to a string
      rather a variant in the VBA wrapper function or convert it to a string in
      the Python code just before returning the value.

      Another idea could be to write a function to "unwrap" the dictionary into a
      n x 2 array and then use it in a worksheet as an Excel array formula.

      If you describe more precisely what kind of behaviour you'd like, maybe
      with some source code snippets, I can try to help you implement what you
      need.

      Eric.

       
  • Dani Budinova

    Dani Budinova - 2014-08-08

    Thanks Eric!
    For now i think that reading some examples and tests will be enough. Can you please provide me a link for them?

    Regards,
    Dani

     
    • Eric Reynolds

      Eric Reynolds - 2014-08-08

      Please take a look at the github site, docs folder.

      The documentation for v2 is still in progress, over the next few days I
      hope to improve on it.

      Let me know how you get on!

       
    • Eric Reynolds

      Eric Reynolds - 2014-08-18

      Hi Dani,
      FYI release v2.0.2 of ExcelPython should deal with dictionary return values gracefully in a worksheet formula - essentially it unpacks them into an n x 2 array.
      Please let me know what you think!
      Regards,
      Eric

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.