h2 set path/environment variables



  • On 15/10/2015 at 01:35, xxxxxxxx wrote:

    Yes, and putting everything between quotes solved the issue.
    So instead of cd c:\program files
    cd "c:\program files"

    Thanks, pim



  • On 15/10/2015 at 07:22, xxxxxxxx wrote:

    strange
    i made test with such code all is ok

    import c4d  
    import os, sys, subprocess  
      
    def main() :  
      pr32 = os.environ['ProgramFiles(x86)'] # get enviro var  
      b = pr32 + '/opera/opera.exe'  
      subprocess.Popen(b)  
      
    if __name__=='__main__':  
      main()
    

    >> b if printed is C:\Program Files (x86)/opera/opera.exe



  • On 15/10/2015 at 07:28, xxxxxxxx wrote:

    As Ilya said, you should definitely do it using the subprocess module.



  • On 15/10/2015 at 08:29, xxxxxxxx wrote:

    WOW this is so helpful guys , nice and thanks for sharing guys. But any tread on Reg..Key that can help? or its the same.



  • On 15/10/2015 at 09:01, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    As Ilya said, you should definitely do it using the subprocess module.

    Ok, I used os.system.
    Shall test it with the examples given.

    Thanks, Pim



  • On 16/10/2015 at 00:54, xxxxxxxx wrote:

    On the Mac I get an error OSError: [Errno 2] No such file or directory.
    It complains about .../python.2.6/subprocess.py" line 1126 in_execute _child.

    I did not yet tested it on a pc.

    On the Mac I am using R16.047.

    -Pim



  • On 16/10/2015 at 01:20, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    On the Mac I get an error OSError: [Errno 2] No such file or directory.
    It complains about .../python.2.6/subprocess.py" line 1126 in_execute _child.

    I did not yet tested it on a pc.

    On the Mac I am using R16.047.

    -Pim

    hi
    I test at windows os, example for opera(web browser, if installed).
    I have question, have you rules what enviro to use? i mean this:

    import os, platform, sys  
    if platform.system().lower().startswith('win') : # winos  
      pass  
    elif platform.system().lower().startswith('dar') : # macos  
      pass
    

    under pass - your functions with vars



  • On 16/10/2015 at 01:45, xxxxxxxx wrote:

    Yes, I use

    if c4d.GeGetCurrentOS() == c4d.GE_WIN:
      windows ...
    else:
      mac ...
    


  • On 16/10/2015 at 01:59, xxxxxxxx wrote:

    argh, sorry, i'm with code from my studying of scons(exescons)

    can post what targets of mac os you want, maybe mac users will help you



  • On 16/10/2015 at 02:09, xxxxxxxx wrote:

    This is the command I want to give on the Mac:

    /Applications/cloud_ui/ccl --help

    I tested subprocess.Popen on the pc and it works ok.
    Just like os.system.

    What is the difference between os.system and subprocess.Popen?

    -Pim



  • On 16/10/2015 at 02:15, xxxxxxxx wrote:

    mmm, you need also shell commands or args for app
    take look - https://docs.python.org/2/library/subprocess.html#popen-constructor



  • On 16/10/2015 at 07:00, xxxxxxxx wrote:

    Any input on my subprocess.Popen issue?

    On the Mac I get an error OSError: [Errno 2] No such file or directory.
    It complains about .../python.2.6/subprocess.py" line 1126 in_execute _child.

    On a pc, I got the same error message.



  • On 16/10/2015 at 08:03, xxxxxxxx wrote:

    I got it now working.
    Here an example on the pc, generating a tasklist and checking if a process is running.

        ps= subprocess.Popen(r'tasklist.exe', shell=True, stdout=subprocess.PIPE)
      
        output = ps.stdout.read()
        ps.stdout.close()
        ps.wait()
        if ("cloud_ui" in output) :
            print "found"
        else:
            print "not found"
    

Log in to reply