[Tutor] Executing a command from a specific directory

Kent Johnson kent37 at tds.net
Thu Sep 17 14:04:49 CEST 2009


On Thu, Sep 17, 2009 at 5:47 AM, Ansuman Dash <ansuman.dash at gmail.com> wrote:
> Hi,
>
> I modified my code little bit and it is working fine now,
>
> =====================================================
>     if os.access("C:/Python25/Own.log", os.F_OK):
>         f = open("C:/Python25/Own.log")
>         time.sleep(30)
> =======================================================
>
> But I have question to ask, as you can see I am using "time.sleep(30)" to
> make my code wait. Is there any other way I can write my script to resolve
> synchronization issues.

How is the log being created? Are you waiting for another process to
finish? You can use the subprocess module to start another process and
then wait for the process to complete.

Kent


More information about the Tutor mailing list