General Discussion & Announcements

 View Only
  • 1.  Start .atsc file using python

    Posted 11-04-2024 12:15

    Good afternoon, I am trying to open a .atsc file that runs a simple macro to automatically log the user in to accuterm.

    I am using the following code:

    from subprocess import Popen

    p = Popen(["patmore_login.atsc"], stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()

    But I get the following error:

     File "C:\Users\mike\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1548, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
                                 # no special security
                                 ^^^^^^^^^^^^^^^^^^^^^
        ...<4 lines>...
                                 cwd,
                                 ^^^^
                                 startupinfo)
                                 ^^^^^^^^^^^^
    OSError: [WinError 193] %1 is not a valid Win32 application

    I can find no information for opening this type of file on google/stackexchange etc

    Any help to go in the right direction would be greatly appreciated.

    Kind regards

    Mike Lankester



    ------------------------------
    Mike Lankester
    Rocket Forum Shared Account
    ------------------------------


  • 2.  RE: Start .atsc file using python
    Best Answer

    Posted 11-04-2024 12:57

    Hi Mike,

    Popen may not understand the file associations the way the command line and file explorer do. Try executing the actual command and pass the file at the command line:

    p = Popen(["c://program files (x86)//atwin71//atwin71.exe","patmore_login.atsc"], stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate()

    You're version of AccuTerm may be different or be in a different place. You also might have to include the full path to your atsc file.

    Sorry if this posts twice. I posted it once and it seems to have just disappeared. Maybe Rocket is having trouble and the first one I posted will eventually go through.



    ------------------------------
    Joe Goldthwaite
    Consultant
    Phoenix AZ US
    ------------------------------



  • 3.  RE: Start .atsc file using python

    Posted 30 days ago

    Good morning, 

    That worked perfectly - thank you very much Joe.

    Kind regards

    Mike Lankester



    ------------------------------
    Mike Lankester
    Rocket Forum Shared Account
    ------------------------------



  • 4.  RE: Start .atsc file using python

    Posted 30 days ago

    Hi Mike,

    Popen may not be using the file associations the way file explorer or the command line do.  Try using the actual exe file and passing your file to the command line:

    subprocess.Popen(["c://program files (x86)//atwin71//atwin71.exe", "patmore_login.atsc""], shell=True)

    The exe file may be different on your system and you might need to include the full path to your atsc file also.



    ------------------------------
    Joe Goldthwaite
    Consultant
    Phoenix AZ US
    ------------------------------



  • 5.  RE: Start .atsc file using python

    Posted 30 days ago

    Hi Mike,

    Popen may not understand the file associations the way the command line and file explorer do. Try executing the actual command and pass the file at the command line:

    p = Popen(["c://program files (x86)//atwin71//atwin71.exe","patmore_login.atsc"], stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate()

    You're version of AccuTerm may be different or be in a different place. You also might have to include the full path to your atsc file.

    Sorry if this posts twice. I posted it once and it seems to have just disappeared. Maybe Rocket is having trouble and the first one I posted will eventually go through.



    ------------------------------
    Joe Goldthwaite
    Consultant
    Phoenix AZ US
    ------------------------------



  • 6.  RE: Start .atsc file using python

    Posted 30 days ago

    If you want to use the file association to open the .atsc file (or any file using its associated application), you might want to try os.startfile()



    ------------------------------
    Peter Schellenbach
    Rocket Internal - All Brands
    ------------------------------



  • 7.  RE: Start .atsc file using python

    Posted 30 days ago

    I didn't know about that one. That's a lot simpler. It's Windows specific though. I guess in this case it doesn't matter since this kind of thing doesn't apply if you're running the mobile version. 



    ------------------------------
    Joe Goldthwaite
    Consultant
    Phoenix AZ US
    ------------------------------