[Tutor] How to run another python script?

Karim karim.liateni at free.fr
Mon Feb 14 17:34:57 CET 2011


Better way is to not have BBB but simply to use Exception (pseudo-code):

try:
<generate zip file>
    ...
catch IOError, e:
     print("Error encountered in generating zip file:",  e)
else:
     import os
     os.remove('<path_to_file>')

Regards
Karim


On 02/14/2011 05:04 PM, Karim wrote:
> On 02/14/2011 04:51 PM, Dan Lee wrote:
>> Hi.
>>
>> I just knew what python is.
>> Now I'm about to write backup script.Now I got 2 scripts.
>>
>> AAA : generate zip file
>> BBB : delete old file.
>>
>> AAA is done.
>> Now I'm going to code BBB file. and I will fix AAA to call BBB to
>> delete dump file at the end.
>
> One possibility:
>
> exec( "<PATH_TO_BBB>/BBB" )
>
> Or make import of BBB module as below:
>
> from BBB import main
> BBB.main()
>
> Regards
> Karim
>
>> Please let me know How can I call the BBB file from AAA file.
>>
>> Thanks in advance.
>> Dan
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list