Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
modify script.
#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


Messages In This Thread
modify script. - by MuhammadTalha - Nov-19-2019, 11:43 AM
RE: modify script. - by Gribouillis - Nov-19-2019, 11:57 AM
RE: modify script. - by MuhammadTalha - Nov-19-2019, 12:00 PM
RE: modify script. - by buran - Nov-19-2019, 12:37 PM
RE: modify script. - by DeaD_EyE - Nov-19-2019, 01:02 PM
RE: modify script. - by ChislaineWijdeven - Nov-20-2019, 01:17 PM
RE: modify script. - by MuhammadTalha - Nov-21-2019, 06:12 AM
RE: modify script. - by DeaD_EyE - Nov-21-2019, 08:21 AM
RE: modify script. - by MuhammadTalha - Nov-21-2019, 09:24 AM
RE: modify script. - by Gribouillis - Nov-21-2019, 09:30 AM
RE: modify script. - by MuhammadTalha - Nov-21-2019, 01:04 PM
RE: modify script. - by Gribouillis - Nov-21-2019, 05:21 PM
RE: modify script. - by MuhammadTalha - Nov-23-2019, 06:38 AM
RE: modify script. - by Gribouillis - Nov-23-2019, 06:45 AM
RE: modify script. - by DeaD_EyE - Nov-23-2019, 03:56 PM
RE: modify script. - by Gribouillis - Nov-23-2019, 04:43 PM

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,313 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  How to modify __init__ of built-in module directly from the script? sonicblind 5 3,701 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