RE: OT Request

2006-10-06 Thread MatthewWarren
> This email is confidential and may be privileged. If you are not the intended 
> recipient please notify the sender immediately and delete the email from your 
> computer.
>
> You should not copy the email, use it for any purpose or disclose its 
> contents to any other person.
> Please note that any views or opinions presented in this email may be 
> personal to the author and do not necessarily represent the views or opinions 
> of Digica.
> It is the responsibility of the recipient to check this email for the 
> presence of viruses. Digica accepts no liability for any damage caused by any 
> virus transmitted by this email.
>

>   Pardon, but is there any possibility you can disable this rather
>long block? I'm presuming you are accessing via the mailing list, but
>hat mailing list is gatewayed to a Usenet news group (and unless you've
>anaged to embed an X-noarchive header in email, Google Groups is going
>o have the message available in perpetuity). There is no single
>intended recipient" -- the messages are being sent to anyone in the
>orld interested in reading comp.lang.python, so all this overhead is
>eaningless.

No problem, and thanks for pointing it out.  It gets silently added on
its way through, and i just hadnt noticed it in my posts.

Posting this time through google groups :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT Request

2006-10-06 Thread MatthewWarren
Funniest bit of my day so far :)

Fredrik Lundh wrote:
> Matthew Warren wrote:
>
> > No problem, and thanks for pointing it out.  It gets silently added on
> > its way through, and i just hadnt noticed it in my posts.
>
> oh, no need to apologize.  and it did make a certain sense in some of
> your posts:
>
> > Okok, I'm silly.
> >
> > This email is confidential and may be privileged. If you are not the
> > intended recipient please notify the sender immediately and delete the
> > email from your computer.
> >
> > You should not copy the email, use it for any purpose or disclose its
> > contents to any other person.
> >
> > Please note that any views or opinions presented in this email may be
> > personal to the author and do not necessarily represent the views or
> > opinions of Digica.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bad Code (that works) help me re-write!

2006-10-11 Thread MatthewWarren
oop. posted with wrong account, sorry for attatched disclamers in other
posts.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bad Code (that works) help me re-write!

2006-10-11 Thread MatthewWarren

Matthew Warren wrote:
> > -Original Message-
> > From:
> > [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]
> > rg] On Behalf Of Giles Brown
> > Sent: 11 October 2006 12:38
> > To: python-list@python.org
> > Subject: Re: Bad Code (that works) help me re-write!
> >
> > Matthew Warren wrote:
> > > I have the following piece of code,
> > 
> > No doubt you will get some kind soul to suggest some things,
> > but if you
> > want really good
> > answers I think you need explain why you want this command file (as
> > opposed to using
> > say a python script itself).  Are you attempting to create a simpler
> > syntax than Python?
> > A restricted set of operations?
> >
>
> The code is from a larger project called the FatController.
>
> FatController is currently a cli based utility for administering &
> monitoring devices & applications in an enterprise environment.
>
> Users enter commands at the prompt do things such as, define a managed
> entity, execute instructions against that entity, etc
>
> The processcommand() function and the command file are my attempt at
> implementing the 'commands' that are available to the user. Rather than
> hard-code all of the syntax and commands inside the module, I wanted an
> external file to maintain the definitions of the commands available to
> the user. The idea is that users will be able to implement their own
> 'entity' modules, which FatController will import and then use to manage
> devices & applications the given entty applies to. So, at the time of
> writing the code  thought It would be a good idea to have the command
> definitions file external to the code, so and-users who write their own
> modules can also extend the cammands available to Fatcontroller for
> using those modules, if required.
>
>
>
> Matt.
>

More info.  An entity 'module' is something that creates connections to
an app/device/machine using whatever protocol, sends native commands to
that device/app/machine, and returns the result.  For example, I have
written an entity of type 'TELNET' that manages anything that you can
use telnet to connect to (hence prev. post on using twisted rather than
telnetlib) . The user could enter something like the following at the
Fatcontroller prompt;

FC:> define entity TELNET unixbox1 192.168.4.5 23 mylogin mypass

the user could then write something like;

FC:> execute unixbox1 ps -ef | grep -c crit_process

the processcommand() function and the command definition file are used
to parse/analyse the user input and pass the relevant parms to the
entity module that then defines the entity for later use/managment, or
pass the given entity command to the entity for execution, and return
of the output. Fatcontroller provides other functionality for working
with entities / groups of entities, scheduling commands to be run
against entites / groups of entities and saving / extracting / alerting
against the output.


...but really, all I'm after is a learning experience, (this whole
project is what I decided to do to learn python) and I know
processcommand() can be written in a more elegant way and that eval()
shouldnt be there, but I have no formal acquaintance with things like
parsers and the subtleties of pythons approach etc.. So I'm hoping
through deconstructing and rebulding the code I can increase my
knowledge of python and the pythonic way to do things.

Aaanyhoo, 

Ta :)

Matt.



Matt.

-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython help wxSashWindow

2006-10-19 Thread MatthewWarren
Hi, I'm wondering if anyone can tell me here, or point to a specific
tutorial (  I have searched for 1/2hour, but can find only reference
style docs or not-quite-what-im-after help) on how to build a
wxSashWindow in wxPython. I'm just starting out with wxPython, and the
first thing i need to do is use 3 sash windows, 1 split vertically, and
on the left and right of that a SashWindow splitting horizontally. I
can make frames, buttons, use sizers etc.. as they are fairly
intuitive, but SashWindow and SashLayoutWindow have stumped me.

Thanks,

Matt.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython help wxSashWindow

2006-10-19 Thread MatthewWarren

John Salerno wrote:
> MatthewWarren wrote:
>
> > I'm just starting out with wxPython
>
> Hi there. Sorry I can't help you because SashWindow isn't something I've
> worked with yet, but I just wanted to let you know that there is also a
> dedicated wxPython newsgroup (not that the people here aren't geniuses!) :)
>
> gmane.comp.python.wxpython (newsgroup)
> [EMAIL PROTECTED] (mailing list)
>
> It's a great resource.

Thanks, is that a newsgroup I can view through google groups? I tried
seraching for it but google says no..

And I'll give that list a subscribe.

I have found a wxPython google group, but only 11 members and a
handfull of posts in a year...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Determining if a file is locked in Windows

2006-10-19 Thread MatthewWarren
elake wrote:
> Larry Bates wrote:
> > elake wrote:
> > > I found this thread about a pst file in Windows being locked and I am
> > > having the same issue.
> > >
>
> > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/d3dee5550b6d3652/ed00977acf62484f?lnk=gst&q=%27copying+locked+files%27&rnum=1
> > >
> > > The problem is that I have a script that can find the pst files on
> > > every machine in my network and back them up to a server for safe
> > > keeping. The problem is that when Outlook is running it locks the file
> > > and will not allow me to copy it to the destination. I am using the
> > > shutil module for the copy.
> > >
> > > Is there a way to first determine if the file is locked and then do the
> > > copy if it isn't? I thought about looking to see if Outlook.exe is
> > > running but the machines are shared and the process could be running
> > > but with a different pst file in use.
> > >
> > > Thanks in advance
> > >
> > Try the copy and catch the exception instead.
> >
> > -Larry Bates
>
> Larry thanks for your suggestion. this is what I tried:
>
> #!/usr/bin/env python
>
> import os, shutil
>
> path = 'c:\documents and settings\username\Local Settings\Application
> Data\Microsoft\Outlook'
>
> src = 'Outlook.pst'
> dst = 'test.pst'
>
> os.chdir(path)
>
> try:
> shutil.copy2(src, dst)
> except IOError:
> print 'Must be locked by Outlook'
>
> print 'Finished'
>
> The problem is that even though I catch the IOError it overwrites the
> dst file and makes it 0kb. This is going to be for backing these files
> up and it wont be good to overwrite the backup with a bad copy.
>
> Is there another way to do this that I am missing. I am still kind of
> new to Python. If i could tell that outlook had the file locked before
> I tried the copy then I think that it would be prevented.

maybe try and open the file for reading first, then if it opens ok,
just close it and do the copy?

-- 
http://mail.python.org/mailman/listinfo/python-list