Data360 Analyze

Welcome to the Data360 Analyze community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Here are some useful links where you can find more information:

Product Announcements  Product Documentation  Ideas Portal

Discussions

Members

Resources

Events

 View Only
  • 1.  Use Input Static node to pass python script to Python Interface Node

    Posted 05-01-2017 10:18

    Hello,

    I saw a demo of Dataverse and it appeared to use a Static Node to pass a python script into the Python Node.  

    1) Is this currently possible to do?

    2) Could someone share a very simple job that shows how to do this using a simple python script?

    3) Is it possible to do this in python 3?

    Thanks,

    Rob



  • 2.  RE: Use Input Static node to pass python script to Python Interface Node

    Employee
    Posted 05-01-2017 10:49

    Our software uses Python 2.7.3.   Python and the StaticData node aren't going to mesh well.

    But, depending upon what you are wishing to do, you can simply put your python script directly into the python node.

    Or, if the following conditions are met:

    1. your script does not need to interact with DV in any way (neither input nor ouput)
    2. for some reason you want it in a static data node
    3. or, if you need python 3

    Then you could put your script into the static data node, and use OutputRaw to save the data to a text file. Then use this code fragment in a python node (put it in the "initialize" subroutine)

    import os
    os.system("/path/to/python3 myscript.py")

    But, huge caveat... the StaticData node is going to be very problematic over commas and question marks.  StaticData is not going to play well with various delimiters.



  • 3.  RE: Use Input Static node to pass python script to Python Interface Node

    Posted 05-01-2017 12:00

    Thanks Stony.  Forgetting Python 3 for the time being-- is there another example available demonstrating the best way to use Python in a Dataverse job?  

    I'm trying to work with the "Example Python Node" job that's included in the install, but I'm not making any progress.

    If there is a different or better example, that's great, could you share?  

    If there is not, could you help me understand how I could view log messages?  Any basic change I make causes the job to fail.  I've tried adding a new line with a custom message, and have adjusted the LogLevel, but I get strange errors about indentation.     

    I read http://localhost:8080/docs/dist/help/Content/h-tech-guides/python-logging-errors.htm and have changed the Node LogLevel to 0.  

    But when I enter:

    self.logInfo("Testing, testing.")

    or

    self.logMedium("Testing, testing.")


    unindent does not match any outer indentation level (temp.L107ATM19M003.4544.129.1493665004886.64e180058116dc9e5c3911f38da0ad16.prop, line 17)

    Any help greatly appreciated.  Thanks, Rob

     



  • 4.  RE: Use Input Static node to pass python script to Python Interface Node

    Employee
    Posted 05-01-2017 12:34

    This is the one thing that I hate about python the most.  I love it for many many things, but this "feature" just kills me.

    In the Python2Implementation input field.. the spacing is done with TABS.
    However, you will find that your code, even though it is aligned properly, is filled with spaces instead of tabs.

    That's why the "indentation" is incorrect.



  • 5.  RE: Use Input Static node to pass python script to Python Interface Node

    Posted 05-01-2017 12:38

    Yep, that was it, thank you.  These info msgs will be a huge help in understanding what the Brain us up to.

     



  • 6.  RE: Use Input Static node to pass python script to Python Interface Node

    Employee
    Posted 05-01-2017 12:43

    <humor> THAT message is from python, so you'll have to report it to python.org </humor>