pythonpythonpathuniverseu2runpy

Change default RUNPY directory in UniVerse


I have UniVerse 11.3.1, and have been taking advantage of Rocket's u2py module to run python code. Overall, this has been great. When calling python code from PICK I usually do PyCallFunction. However I have a number of scripts I run directly from the RUNPY command in TCL.

In refactoring some of my directories I am moving away from having the PP directory house my python code. I can call my scripts from a new directory, say PYSCRIPTS, but it means if I have a bash or TCL script that calls RUNPY I now have to explicitly call out which directory I call it from:

RUNPY PYSCRIPTS test.py instead of RUNPY test.py.

Is there a way to change the default directory that RUNPY looks in? Is this related to PYTHONPATH configuration, or is this hard-coded in the UniVerse binary? A minor inconvenience, but I would rather handle the parent directory of these scripts via configuration vs hard-coding them.


Solution

  • The crusty old UniVerse guy in me says use a VOC entry, but that will only work in the Account you put it in.

    >ED VOC RUNPY2
    New record.
    
    ----: I
    0001= S
    0002= RUNPY PYSCRIPTS
    0003=
    Bottom at line 2.
    ----: FI
    "RUNPY2" filed in file "VOC".
    

    However that doesn't solve your BASH requirement. For that I think there is some pathing info in a .pth file in each account.

    You probably want to get a hold of the document titled "U2Python User Guide" for your version and look for the section on .pth files. These hold some path related variables. There are warnings there about some of the variables being overwritten on upgrade, and I have no first hand experience which is why I am being unreasonably vague about what you should do.

    Good Luck