Sorry, I cannot reproduce this one (OpenSUSE 12.3 x64, PyQt 4.9.6).
I took your code and added a line window.show()
to main()
(despite your comment saying that you were "doing window.show()
"). I also replaced the line
userRecvdFrom = newUsrFile(".")[0]
with
userRecvdFrom = newUsrFile.split(".")[0]
The former gives a runtime error because newUsrFile
is a string and you can't call it. I also changed the directory being watched as I don't have a directory with that name on my machine.
After doing this, I could reliably create files in the folder being watched and have the program pop up alert boxes. After each alert was dismissed the program stayed running.
So I can only speculate at what the problem might be. You say you are instantiating SendMyfiles
, in code that you have chosen not to share with us, but how long does this object stay in existence for? Do you keep a reference to this object, or is it only stored in a local variable and hence gets garbage collected at the end of a method? If you have a PyQt window object, and all references to it are lost, Python will garbage-collect it, which will cause the underlying Qt C++ object to be deleted and the window closed.