Hello, I have a program that uses pyside for an QT interface and a thread that downloads a lot of files. The thread is created with QThread object. But my problem I don't think it's QT related.
The thread retrieves with pycurl a file that contains a list of files and start to downloads them. The downloading is done as following: - instantiate a Curl object - open the file on local filesystem for write in binary mode (in a try block), with the name suffixed with .part. - pass the description to the curl object for save. - curl retrieve and save it. It has also a callback function that updates the interface, sending a QT signal to the interface. (1) - use os.rename to rename the file with .part sufix to the final file. On my interface I have 3 buttons. One of the buttons runs an .exe file. One button closes the interface and one is deactivated. On the button that runs the exe I have a callback function that uses subprocess.Popen (for not waiting) for running a program (.exe) and returns. For now I configured to run calc.exe. The callback is not defined inside the downloader thread. It's defined globally (nor in QMainWindow object). The problem appears when I close the called program (in our case calc.exe). The (1) part (the call of os.rename) raise an exception: <type 'exceptions.WindowsError'> (32, 'The process cannot access the file because it is being used by another process') [Error 32] The process cannot access the file because it is being used by another process Question is why? And how to avoid this issue? The same program on Linux works very fine (that's because Linux doesn't has this violation access)! If I remove (1) part the program works fine. Somehow after closing the spawned process (calc.exe - you see, it has nothing to do with a open file somewhere else) the thread losses the acces to the current opened file by itself. -- Claudiu Nicolaie CISMARU GNU GPG Key: http://claudiu.targujiu.net/key.gpg T: +40 755 135455 E: clau...@virtuamagic.com, claudiu.cism...@gmail.com
signature.asc
Description: This is a digitally signed message part.
-- http://mail.python.org/mailman/listinfo/python-list