modify script. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: modify script. (/thread-22598.html) Pages:
1
2
|
RE: modify script. - MuhammadTalha - Nov-21-2019 cannot stat '_ph0/pb.dvscf1': no such file or directory this error generates RE: modify script. - Gribouillis - Nov-21-2019 I'd like to know where the error happened in your script. For this you can add the following file os2.py in the same directory as your script, and at the top of your script, you replace import os with import os2 as os ,then run your script and report the whole error traceback here again. # os2.py from os import * import subprocess as sp class CommandFailed(Exception): pass def system(command): try: retcode = sp.call(command, shell=True) if retcode < 0: raise CommandFailed( ('Command was terminated by signal', -retcode, 'Command was', command)) elif retcode: raise CommandFailed( ('Command failed with return code', retcode, 'Command was', command)) return retcode except OSError as e: raise CommandFailed( ('Command failed with OSError', e.args, e.filename, e, 'Command was', command)) RE: modify script. - MuhammadTalha - Nov-23-2019 hi Gribouillis , this error generated ,
RE: modify script. - Gribouillis - Nov-23-2019 Normally python prints exactly where the error occurs in the python script. This is the useful part. This is what my code was supposed to show. RE: modify script. - DeaD_EyE - Nov-23-2019 (Nov-23-2019, 06:45 AM)Gribouillis Wrote: Normally python prints exactly where the error occurs in the python script. This is the useful part. This is what my code was supposed to show. It can't, because this program is calling for everything extensively rm and cp .The error came from rm and cp itself, but the program has no clue about Python.So it can't give the expected output. If the creator has used Python-Functions instead of os tools, the code will be much denser and lesser. RE: modify script. - Gribouillis - Nov-23-2019 DeaD_EyE Wrote:It can'tIt can if you catch the return code of the command as I suggested above. |