Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    h2 set path/environment variables

    Scheduled Pinned Locked Moved PYTHON Development
    17 Posts 0 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              Yes, I use

              if c4d.GeGetCurrentOS() == c4d.GE_WIN:
                windows ...
              else:
                mac ...
              
              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        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"
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post