This list is amazing, I scratch my head, think and think then finally
post a question, maybe its the act of spelling it out, ps ax showed 2
x 'tail' processes, I am guessing zombies of previous attempts, killed
them, all works AOK now
On 10 June 2012 10:06, dave selby wrote:
> I
I have a simple script to tail a log file for an error string, it
works AOK but there is an unexpected side effect, when I run it in a
shell.
if I
echo "ERROR TEST" >> LOG
in a separate shell, I get the following from the script
ERROR TEST
GOT YA :)
ERROR TEST
So it looks like I am getting std
On 5 June 2012 12:05, dave selby wrote:
> I was running the thread by instantiating a separate class but this
> will make the very neat CallAfter() difficult, is it OK to call a
> method in the main class as a thread in which case the CallAfter()
> should work OK ?
>
> Tha
Hi All,
If a thread is started and 'self' is passed as a parameter, is it
acceptable to access methods of the calling class via
'self.updateGrid()' etc from within the thread or does everything have
to be done via wx.lib.pubsub and publisher calls ?
Cheers
Dave
--
Please avoid sending m
HI,
I have an attatched mymobiler device which I can send string to, I
need to send a cursor down command but am having problems,
I need to send ... 224 followed by 80 I found this by monitering msvcrt.getch()
However I do not know how to construct this, chr(224) + chr(80)
returns a loud bleep f
Hi All,
I have a long string which is an HTML file, I strip the HTML tags away
and make a list with
text = re.split('<.*?>', HTML)
I then tried to search for a string with text.index(...) but it was
not found, printing HTML to a terminal I get what I expect, a block of
tags and text, I split the
Did a lot more digging and finally sorted it, sorry for bothering you guys,
Cheers
Dave
On 20 August 2011 10:58, dave selby wrote:
> I am trying to read and decode an emails PDF attachment via python,
> its a dedicated mailbox, anything emailed there is to be read by the
> script, del
I am trying to read and decode an emails PDF attachment via python,
its a dedicated mailbox, anything emailed there is to be read by the
script, deleted from the mailbox and processed.
http://pastebin.com/VA1gwWH3
def get_next_mail() works AOK, I get a nice long string containing the
next email a
Hi,
I have upgraded to python 2.6 and was getting depreciation warnings
about os.popen3 etc so I changed over to subprocess.
os.popen3('nohup %s/core/kmotion_hkd2.py &> /dev/null &' % kmotion_dir)
becomes ..
subprocess.Popen('nohup %s/core/kmotion_hkd2.py &> /dev/null &' %
kmotion_dir, shell=Tr
Hi,
I have been hitting my head on a brick wall on a bit of code that
refuses to work. I have similar code in other scripts that works AOK
I have commented out all functionality except the core problem ...
import sys, threading, time, os.path, urllib, time, signal, ConfigParser, logger
def
Hi All,
Why when I use threads in my app (I know they are evil ...lol) does it
not stop with ctrl-c, I have to use ctrl-z ?
Cheers
Dave
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
__
Hi All,
I am trying to get a named pipe working, I have already made a fifo
[EMAIL PROTECTED]:/usr/local/bin$ ls -al /home/dave/kmotion2/www/pipe_func
prw-rw 1 dave www-data 0 2008-08-20 20:25 /home/dave/kmotion2/www/pipe_func
[EMAIL PROTECTED]:/usr/local/bin$
but when I execute my test cod
Hi all,
I am using the pwd lib where I am codeing things like ...
gid = pwd.getpwnam(apache2_user)[3]
where as I would like to code it as ...
gid = pwd.getpwnam(apache2_user)[pwd.pw_gid]
but I get
gid = pwd.getpwnam(apache2_user)[pwd.pw_gid]
AttributeError: 'module' object has no attribute 'p
Hi all,
I have a main directory 'kmotion2' where python scripts live. They
access a library of scripts in 'kmotion2/core' as 'kmotion2/core' has
a __init__.py file. However I now need to create a new directory
'utilities' inside 'kmotion2' that also needs to access scripts in
'core'
kmotion2 dir
Hi all,
Is there a neat way to split a string on either of two delimiters ie
space and comma
Cheers
Dave
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
___
Tutor maillist - Tu
Thanks for all your help guys, I am getting a strong consensus that
f.close() should be used everywhere, reading files as well as writing
files and not to rely on the PVM to do clean-up for you.
The whole topic came up because I just finished reading 'learning
python' 3rd edition OReilly as a refr
Hi All,
Up to now I when I need to write some data to a file I have been
purposely using close()
f = open(conf, 'w')
f.writelines(lines)
f.close()
Is it as safe to use the following
open(conf, 'w').writelines(lines)
ie no close() to flush the data, but also not assigned an object name
so
Hi All,
I need to read parse and re-write the parsed file. I am opening with
f = open(file_rc, 'r+')
reading file
f.seek(0)
resetting file pointer ...
print >> f, section
writing smaller file...
and I end up with the remnants of the old larger file at the end.
any idea how to clip the
Hi All,
I am trying to improve my code quality and have started using doc
strings. What format do you guys use for your doc strings ?
I have 'made up' the following general format ...
Cheers
Dave
def gen_vhost(kmotion_dir):
"""
Generate the kmotion vhost file from vhost_template expan
Hi all,
I am after some advice / suggestions. I have written web interface for
viewing CCTV images http://code.google.com/p/kmotion/wiki/ScreenShots
its called 'kmotion'. Underneath its all Python daemons. It usually
runs stand alone on headless servers. Now I am about to write a KDE
interface in
Hi all,
I have a series of class instances saved in an array. I need the
instances to respond to a SIGKILL by writing to a file and
sys.exit()-ing.
Am I right in codeing it as below ? ... does the sys.exit() kill the
instance or the instance & the instance holding array definition above
it ?
Che
Hi All,
I am using the ConfigParser module, I can 'get' from a config file
fine, when I try to set it, it silently fails. the code.
parser = ConfigParser.SafeConfigParser()
parser.read('./daemon.rc')
print parser.get('feeds', 'number')
parser.set('feeds', 'number',
On 24/02/2008, Dave Kuhlman <[EMAIL PROTECTED]> wrote:
> On Sun, Feb 24, 2008 at 04:14:02PM +0000, dave selby wrote:
> > I have created a list of class instances, works a treat. I need to be
> > able to re __init__ the instances on a SIGHUP so I guess the best way
> &
I have created a list of class instances, works a treat. I need to be
able to re __init__ the instances on a SIGHUP so I guess the best way
is to destroy them & re make them.
err ... how do I destroy an instance ?
Cheers
Dave
--
Please avoid sending me Word or PowerPoint attachments.
See http
Hi all,
Returning to python after a brief affair with C++, I have the following code ...
if (items.has_keys('snapshot_interval')):
self.snap_init[i] = items['snapshot_interval']
else:
self.snap_init[i] = 0
I thought Python h
Hi all,
I am not sure if this is a Python or bash issue :).
In bash if I execute 'motion' with the following ...
[EMAIL PROTECTED]:~/.kde/share/apps/kmotion$ motion &> /dev/null &
[1] 10734
[EMAIL PROTECTED]:~/.kde/share/apps/kmotion$
I get what I expect, a background job, however if I execute
Hi all,
I need to write a newline at the end of a string I am appending to a
file. I tried ...
journal.write('%s#%s\n' % (jpeg[:-4], self.snap_init[feed]))
The text is all there but no new line at the end any idea what I
am doing wrong ? ... thought \n would do it.
Cheers
Dave
--
Plea
Hi all,
I have written a daemon as part of a larger project, if it recieves a
SIGHUP signal it needs to re-read its config file. It works in that I
get 'signal HUP detected, re-reading config file' in syslog but then
the script exits ... mmm first time I have used signal catching
... thought
OK so to condense the problem the following works at LOG_INFO default
priority ...
def log(self, msg, priority):
syslog.openlog(self.ident , syslog.LOG_PID)
syslog.syslog('testing message')
syslog.closelog()
But as soon as I try to set a priority API syslog docs, it fa
Im having a bad day. The logging module refused to send anything to
syslog no matter what I did, so discovering the syslog module &
thought, for what I need I will write a simple class to do the job.
class kmotion_logger:
def __init__(self, ident, min_priority):
# min_priority must b
I am trying to use the python logging module. At first glance it looks
pretty complicated but having Ggooled a lot I have come up with a
trial script of ...
logging.config.fileConfig("logging.conf")
logger = logging.getLogger()
logger.critical("Test Message")
Where 'loggin.conf' contains ...
[l
Is there a way for a Python script to intercept a HUP signal sent to it ?
Cheers
Dave
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
___
Tutor maillist - Tutor@python.org
http:/
Can anyone tell me where the documentation for pythons xf86misc module
is, ie what methods are avalible ?
Many thanks
Dave
--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
___
T
33 matches
Mail list logo