From: | Saran A |
Sent on: | Tuesday, March 31, 2015, 7:16 AM |
I'm assuming it's the directory monitoring that is your main concern (checking a file for length 0, moving a file to another directory, etc are all relatively easy problems). I'd recommend watchmedo - a python package that monitors the filesystem for changes. https://pypi.python.org/pypi/watchdog. Install with "pip install watchmedo"A simple (python 2.7) program that does what you're looking for (put your file-scanning logic in on_created() - right now it just prints out the new file's name) is below. Watchmedo is cross platform, and it uses native filesystem monitoring facilities when available, so it should be pretty performant.
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class FileEventHandler(FileSystemEventHandler):
def on_created(self, event):
print "process", event.src_path, "here"
if __name__ == "__main__":
path_to_monitor = "."
event_handler = FileEventHandler()
observer = Observer()
observer.schedule(event_handler, path=path_to_monitor, recursive=False)
observer.start()
raw_input("press enter to stop monitoring")
observer.stop()
observer.join()On Mon, Mar 30, 2015 at 1:47 PM, Kevin Sheppard <[address removed]> wrote:* Some python modules require not-included libraries, e.g. NumPy, and are extremely difficult to build on Windows.Personally I find the Anaconda distribution far simpler to use than the official Python for Windows since many binary packages are pre-built. It is a free download https://store.continuum.io/cshop/anaconda/4. Install Cython using pip install cython3. Install Microsoft Compiler for Python http://www.microsoft.com/en-us/download/details.aspx?id=442662. Install pip, if it isn't installedIf you require a binary module that [this is important] provides all required binary code, either in the from of C/C++ source files or Cython code*, then you should be able to do the following.1. Install Python for Windows
--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Kevin Sheppard ([address removed]) from DC Python.
To learn more about Kevin Sheppard, visit his/her member profile
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]
--Mark Wright
[address removed]
--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Mark wright ([address removed]) from DC Python.
To learn more about Mark wright, visit his/her member profile
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]