Skip to main content
Alejandro Garcia
Participating Frequently
Jun 19, 2023 10:41 AM UTC
Question

UOPY - Executing command with Pick flavor

I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

Can we set up some options so the command executes using Pick flavor? 

I already tried setting the TCLTYPE before running the command, but it doesn't work.

Connection established
done reading
file uploaded

Compiling Unibasic: TESTPROGRAM in mode 'u'.
main program: syntax error at or before
<line 2578>       READSELECT NH ELSE HN.RECS = ""
            -----------------------^
Expecting: =,:,+,-,*,/,[,<

Any suggestions? 

Thanks in advance

    17 replies

    Alejandro Garcia
    Participating Frequently
    Jun 20, 2023 3:58 PM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    Oh ok.. I will give it a try just to see.. 

    Thanks :)

    Participating Frequently
    Jun 21, 2023 8:37 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    Mike, 

    You Said

    "For uopy, or any UniObjects client, you can set the BASIC type in the UOLOGIN subroutine."

    how does machine determine if the connection is from UniObjects ?

    Jonathan Smith
    Rocketeer
    Jun 21, 2023 8:45 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    @robert modrich 

    Robert,

    When you connect to UD (or UV) using UniObjects your first connection request goes the unirpcd process and it checks the service name you are requesting to connect to. 

    So for UniObjects this would we udcs (for UniData) , uvcs for (UniVerse) or defcs (defcs is the default and will be set to UV or UD if only UV or UD are installed). Below are the example service names from the unirpcservices file.

    udcs /disk1/ud82/bin/udapi_server * TCP/IP 0 3600

    uvcs /disk1/uv1132/bin/uvapi_server * TCP/IP 0 3600

    defcs /disk1/ud82/bin/uvapi_server * TCP/IP 0 3600

    You will see that a UniObjects connection will run a  udapi_server process (or uvapi_server process) and is the fact that it is running this process that allows UD or UV to determine if your running from a UniObjects connection.

    Regards,

    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    Participating Frequently
    Jun 22, 2023 9:02 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    Jonathan

    when executing a basic program in the login proc what command is used to determine if login came from uniobjects?

    Jonathan Smith
    Rocketeer
    Jun 22, 2023 9:21 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    @robert modrich 

    There isn't a command you can execute to determine if the login came from UniObjects.

    Environment variable @USER.TYPE  

    Returns the type of process currently running. UniBasic has four types of processes:
    0 – Normal terminal processes.
    1 – Background (phantom) processes.
    2 – Redirected standard input.
    3 – UniObjects, or any other client process.

    The environment variable @U2PY 

    @U2PY

    A string that returns the number of the Python level at which the current BASIC program is running. Without Python, @U2PY has the value of 0. With Python, @U2PY has the value of a positive integer (1, 2,3, ...).

    The function SYSTEM(55)

    Returns the number of the Python level at which the current BASIC program is running.
    Returns 0 without Python.
    Returns the value of a positive integer (1, 2, 3, ...) with Python.
    Note: SYSTEM(55) has been implemented to return the same value as @U2PY.

    Regards,

    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    Mike Rajkowski
    Rocketeer
    Jun 22, 2023 10:20 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    Alejandro,

    It is mentioned in a few different documents.

    For instance:

    Rocket U2 Clients and APIs -  Administrative Server Settings and Logging for U2 Clients

    See "Chapter 6: U2 server security control subroutine and U2 environment settings"

    Mark Sapp
    Rocketeer
    Jun 23, 2023 11:02 AM UTC

    I have a Python script that uploads a program and tries to compile it. But every time it compile my program errors because we use Pick. 

    Can we set up some options so the command executes using Pick flavor? 

    I already tried setting the TCLTYPE before running the command, but it doesn't work.

    Connection established
    done reading
    file uploaded

    Compiling Unibasic: TESTPROGRAM in mode 'u'.
    main program: syntax error at or before
    <line 2578>       READSELECT NH ELSE HN.RECS = ""
                -----------------------^
    Expecting: =,:,+,-,*,/,[,<

    Any suggestions? 

    Thanks in advance

    @robert modrich 

    To pile on to Jonathan & Mike's great comments - 

    An example of using USERTYPE - a program that can run either in interactive mode or as a background process.  This program has screen output and inputs in interactive mode and suppresses inputs and output if the USERTYPE = 1.  

    An example of where UOLOGIN is very useful - if you set up a service account dedicated to one specific uniobjects use, then you take action based specifically for that "user".  For example, all calls to the backend from the web use a login of "redback"  you can take action only for that service account (certain programs are run to initialize some common variables, etc.). 

    Another example is that you need to allow developers to login to the unidata shell and all other users are by default forced into the application (and not allowed shell access).