Python script behaves differently when running batch file and cmd line

I have a Python script that needs to be run using a batch file, but I used cmd to test it. When you go through cmd, it works fine. However, the script seems to behave differently when the batch file is launched. I highlighted a section of code that seems to be the problem:

CRFOLDER = "some path to all my files"

isReady = False
os.startfile(os.path.join(CRFOLDER,"CLogger.exe"))

while not isReady:

    try:
        open(os.path.join(CRFOLDER,"CRPYLog.py"))
        isReady = True
    except:
        print "Not ready yet"
        time.sleep(0.25)

import CRPYLog as PyLog

, Python, ( , ). , cmd. , , while (, , 2 , cmd, except ). . , . .

start Y:\Admin\Anaconda\python.exe "Y:\Projects\Advent - Overhead Projects\Copy - ADV001 - CR Records Management - Copy\Python\CRWizard.py" 

cmd, , .

+4
2

, Windows (os.startfile) , , ( ), , CRFOLDER.

, foder .py , , , , .

+2

start. . . .

Y:\Admin\Anaconda\python.exe "Y:\Projects\Advent - Overhead Projects\Copy - ADV001 - CR Records Management - Copy\Python\CRWizard.py"
0

All Articles