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

    David Green
    Inspiring
    Jun 19, 2023 11:14 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

    Use BASICTYPE P

    Alejandro Garcia
    Participating Frequently
    Jun 19, 2023 3:09 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

    Thanks David, but quick question, 

    Instead of using

    compileCmd = uopy.Command("BASIC "+dname+" "+fname, session=_session)

    should I use?
    compileCmd = uopy.Command("BASICTYPE P "+dname+" "+fname, session=_session)
    David Green
    Inspiring
    Jun 19, 2023 3:23 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

    BASICTYPE is a TCL command.  This will set the Basic Compiler to PICK type.  You should be able to set it in your login paragraph.

    The other method is to add BASICTYPE P as the first line of code in your program.

    Alejandro Garcia
    Participating Frequently
    Jun 19, 2023 4:40 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

    It doesn't work.. here is my code: 

    setTypeCmd = uopy.Command("BASICTYPE P", session=_session)
    compileCmd = uopy.Command("BASIC "+dname+" "+fname, session=_session)
    Same output. I tried BASICTYPE and ECLTYPE, but the mode is still 'u'.
    Doug Averch
    Inspiring
    Jun 19, 2023 5:12 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

    If you change your source code and put this line at the top, it will compile correctly everywhere:

    $BASICTYPE "P"

    Doug Averch Owner https://www.u2logic.com/
    Tyrel Marak
    Participating Frequently
    Jun 20, 2023 1:36 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

    Alejandro,

    Have you tried compiling adding +PICK? 
    e.g. BASIC PFile PName +PICK where PFile is the Program File, and PName is the Program Name.

    Or have you tried the keyword PICK.FORMAT?

    Mike Rajkowski
    Rocketeer
    Jun 20, 2023 2:44 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

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

    i.e.

    SUBROUTINE UOLOGIN(RTNVAL,APPNAME) 
    * Parameters 
    * RTNVAL - If RTNVAL is a nonzero value, the connection is allowed. If it is zero, the connection is disallowed and an error message is returned. 
    * APPNAME - The name of the client application trying to establish the connection. 
    EXECUTE 'BASICTYPE "P"'
    RTNVAL = 1 
    RETURN

    Alejandro Garcia
    Participating Frequently
    Jun 20, 2023 3:05 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

    Hi Tyrel,

    I think I don't know how to use the +PICK option. I went to TCL first and tried:

    :BASIC BP TEST PICK                                       
    item id =TEST                                            
                                                                                    
    Compiling Unibasic: ACCOUNTSHRPY.DBDEFN.SRCBPTEST in mode 'p'.                                                  
    compilation finished                                                            
    item id =PICK                                                                   
    errno=2: No such file or directory                                              

    The +PICK option is a UOPY option? 

    And for the PICK.FORMAT, no idea how to use or set that keyword. 

    Alejandro Garcia
    Participating Frequently
    Jun 20, 2023 3:10 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

    Hi Mike, thanks for the suggestion,

    This worked like a charm. Any idea where can I get more documentation about this? This is awesome.. thank you so much

    Tyrel Marak
    Participating Frequently
    Jun 20, 2023 3:26 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

    Sorry, I had that wrong; I should have said +$PICK.  It's basically using a compiler directive at the command line, so it's part of UniVerse BASIC command.