Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9639

Re: Looking for general advice on complex program

References <4ab6df51-ec86-4144-98a6-71d372f09f74@glegroupsg2000goo.googlegroups.com>
Date 2011-07-16 14:08 -0400
Subject Re: Looking for general advice on complex program
From geremy condra <debatem1@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1120.1310839733.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jul 15, 2011 at 3:47 PM, Josh English
<Joshua.R.English@gmail.com> wrote:
> Maybe not to the gurus here, but for me, this is a complex problem and I want to make sure I understand the real problem.
>
> All of this is in Python 2.7 and wxPython
>
> I have several XML files on a shared drive.
> I have applications on other machines that need to access this XML file.
> These applications need to read and write to this file.
> These applications need to a) be alerted to a file change, or b) monitor the file for changes and regular intervals.
>
> In my code, I have XManager classes (using a Singleton pattern) that reads each XML file into a tree (using ElementTree). The XManager class can read the file, make changes to the tree, and write the file as needed.
>
> Now I'm expanding to the multiple application level, and I think I understand what I need to do, and I'm unsure about the exact processes.
>
> I've been trying to have the XManagers check periodically if the XML file they monitor has changed. Since I don't want to mess up the GUI with constant hanging, I think I can use the thread or threading modules to create a recurring timed check, and then I need a separate check to see if the file is in use before reading or writing.
>
> I also need, I think, to have a way to check if the GUI is editing a node before the XManager reads the file, so the thread needs to be interrupted, or paused, because I don't know if threads would stop if a wxDialog is being show modally or not.
>
> So, am I on the right track here?

I'd try watchdog[0] before I went to the trouble of rolling my own.

Geremy Condra

[0]: http://packages.python.org/watchdog/

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Looking for general advice on complex program Josh English <Joshua.R.English@gmail.com> - 2011-07-15 12:47 -0700
  Re: Looking for general advice on complex program Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-15 16:03 -0400
    Re: Looking for general advice on complex program Cameron Simpson <cs@zip.com.au> - 2011-07-16 08:37 +1000
    Re: Looking for general advice on complex program Chris Angelico <rosuav@gmail.com> - 2011-07-16 10:01 +1000
  Re: Looking for general advice on complex program geremy condra <debatem1@gmail.com> - 2011-07-16 14:08 -0400

csiph-web