Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modify script.
#11
cannot stat '_ph0/pb.dvscf1': no such file or directory
this error generates
Reply
#12
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))
Reply
#13
hi Gribouillis ,
this error generated ,
Error:
cp: cannot stat '_ph0/diam.dvscf1': No such file or directory cp: cannot stat '_ph0/diam.phsave': No such file or directory cp: cannot stat '_ph0/diam.q_2/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_2/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_3/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_3/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_4/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_4/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_5/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_5/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_6/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_6/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_7/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_7/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_8/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_8/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_9/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_9/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_10/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_10/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_11/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_11/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_12/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_12/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_13/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_13/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_14/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_14/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_15/diam.dvscf1': No such file or directory rm: cannot remove '_ph0/diam.q_15/*wfc*': No such file or directory cp: cannot stat '_ph0/diam.q_16/diam.dvscf1': No such file or directory
Reply
#14
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.
Reply
#15
(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.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#16
DeaD_EyE Wrote:It can't
It can if you catch the return code of the command as I suggested above.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,215 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  How to modify __init__ of built-in module directly from the script? sonicblind 5 3,548 Jul-31-2018, 12:48 PM
Last Post: sonicblind

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020