Python Forum
Code used to work 100%, now sometimes works!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code used to work 100%, now sometimes works!
#1
I have a remote server that records live TV. Every night I run a python script that copies new TV recordings to my local (home) PC over a VPN so I can watch those episodes at home.

Once the files are copied to my home PC, I run 2 'external' command line applications on them (comskip.exe - to remove commercials; and ccextractor.exe - to create an external .srt (subtitle) file).

the 2 'external' applications used to run 100% of the time, now, at best, they work 50% of the time. I get no errors, and my internal logs (from the script) don't show any glaring issues. The script seems to exit fine, as the last command is to write 'Applicaiton Finished' to a text file, which completes fine.

All PC's involved are Windows 11, and I believe I am on the latest version of Python (3.11.1).

I am happy to provide the entire script if needed, but the relevant 'Function()' is below. Can anyone tell me what might be causing it to not run the external applications sometimes?

def MoveFile(pFile, pDest):
    isFile = os.path.isfile(pFile)
    if isFile == True:
        dPath=os.path.dirname(pDest)
        isDir = os.path.isdir(dPath)
        if isDir == False:
            CreateFolder(dPath)
        
        os.system('move "%s" "%s"' % (pFile, pDest))
        WriteLog("Moved: '%s' to '%s'" % (pFile, pDest))
        
        if right(pDest, 3) == "mpg":
            #BEGIN CCEXTRATOR
            ccCmnd = [ccPath, pDest]
            WriteLog ("BEGIN: Closed Captions Extraction on %s: %s" % (pDest, ccCmnd))
            ccErrCode = subprocess.Popen(ccCmnd, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
            csCmnd = [csPath, "--ini=" + BasePath + "Comskip\\comskip.ini", pDest]
            WriteLog ("BEGIN: Comskip on %s: %s" % (pDest, csCmnd))
            csErrCode = subprocess.Popen(csCmnd, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
    else:
        WriteLog("Info: '%s' is not a file, so won't be moved." % pDest)
Reply


Messages In This Thread
Code used to work 100%, now sometimes works! - by muzicman0 - Jan-08-2023, 05:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  hi need help to make this code work correctly atulkul1985 5 801 Nov-20-2023, 04:38 PM
Last Post: deanhystad
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,052 Nov-15-2023, 06:56 PM
Last Post: jst
  newbie question - can't make code work tronic72 2 696 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Code works but doesn't give the right results colin_dent 2 728 Jun-22-2023, 06:04 PM
Last Post: jefsummers
  Beginner: Code not work when longer list raiviscoding 2 832 May-19-2023, 11:19 AM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,810 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 899 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  Something the code dont work AlexPython 13 2,268 Oct-17-2022, 08:34 PM
Last Post: AlexPython
  cannot get code to work Led_Zeppelin 10 2,467 Jun-30-2022, 06:28 PM
Last Post: deanhystad
  How does this code work? pd_minh12 3 1,363 Apr-15-2022, 02:50 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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