trigger at TDM/2 only

2013-06-06 Thread cerr
Hi, I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm which oly leaves the waiting while loop if

Re: trigger at TDM/2 only

2013-06-07 Thread cerr
DaveA, Yep, that seems to just be about it! Much easier! Thanks for the hint! Much appreciated :) Ron On Thursday, June 6, 2013 5:43:11 PM UTC-7, Dave Angel wrote: > On 06/06/2013 08:03 PM, cerr wrote: > > > Hi, > > > > > > I have a process that I can

Re: trigger at TDM/2 only

2013-06-07 Thread cerr
MRAB, Thanks for the hint! Yep, that's much easier! Thanks! :) Ron On Thursday, June 6, 2013 5:49:55 PM UTC-7, MRAB wrote: > On 07/06/2013 01:03, cerr wrote: > > > Hi, > > > > > > I have a process that I can trigger only at a certain time. Assume I have a

dump a multi dimensional dictionary

2013-07-26 Thread cerr
Hi, Can I somehow use pickle.dump() to store a dictionary of lists to a file? I tried this: >>> import pickle >>> mylist = [] >>> mydict = {} >>> mylist = '1','2' >>> mydict['3'] = mylist >>> fhg = open ("test", 'w') >>> pickle.dump(fhg,mydict) Traceback (most rece

binary key in dictionary

2013-07-30 Thread cerr
Hi, In my application I have followingf lines: print curr_mac print hexlify(buf) binmac = unhexlify(curr_mac) tmpgndict[binmac] += buf curr_mac being a 3Byte MAVC address in ASCII and I want to populate a dictionary where the value(b

logger doesn't roll over

2012-11-21 Thread cerr
Hi, I'm using Python's logger for logging but it doesn't seem to roll over, my file is now 2.2MB and should've rolled over after ever 1MB. My code: logger = logging.getLogger("") logger.setLevel(logging.DEBUG) handler = logging.handlers.RotatingFileHandler( LOGFILE

trac.util

2012-04-11 Thread cerr
Hi, I want to install some python driver on my system that requires trac.util (from Image.py) but I can't find that anywhere, any suggestions, anyone? Thank you very much, any help is appreciated! Error: File "/root/weewx/bin/Image.py", line 32, in from trac.util import escape ImportError

HTTP post with urllib2

2013-08-06 Thread cerr
Hi, Why does this code: #!/usr/bin/python import urllib2 from binascii import hexlify, unhexlify host = "localhost" uri="/test.php" data ="\x48\x65\x6C\x6C\x6F\x57\x6F\x72\x6C\x64" #Hello World url="http://{0}{1}?f=test".format(host, uri) req = urllib2.Request(url, data,{'Content-Type': 'appli

Re: HTTP post with urllib2

2013-08-06 Thread cerr
On Tuesday, August 6, 2013 4:08:34 PM UTC-7, Joel Goldstick wrote: > On Tue, Aug 6, 2013 at 6:52 PM, cerr wrote: > > > Hi, > > > > > > Why does this code: > > > > > > #!/usr/bin/python > > > > > > > > > impor

Re: HTTP post with urllib2

2013-08-07 Thread cerr
On Tuesday, August 6, 2013 5:14:48 PM UTC-7, MRAB wrote: > On 06/08/2013 23:52, cerr wrote: > > > Hi, > > > > > > Why does this code: > > > > > > #!/usr/bin/python > > > > > > > > > import urllib2 > > >

question about posting data using MultipartPostHandler

2013-08-15 Thread cerr
Hi, I want to use http post to upload data to a webserver but I want to pass multiple arguments within the post i.e. I know that you can load one item (data)in there like this: data = {"data":open(filename,"rb")} response = opener.open(url, data, ti

http post goes into $_REQUEST instead into $_FILES

2013-08-15 Thread cerr
Hi, I have a Python script that is executing an http POST to transfer a file from the client to the server. I have achieved this with below code: from binascii import hexlify, unhexlify from httplib import HTTPConnection, HTTPException import os import hashlib import socket import urllib2 import

replace only full words

2013-09-28 Thread cerr
Hi, I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I drink in the house." Would become "I in the ." (and not "I in the .")I have attempted it like this: for sentence in sentences: for noun in nouns: if " "+n

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > On 2013-09-28 09:11, cerr wrote: > > > I have a list of sentences and a list of words. Every full word > > > that appears within sentence shall be extended by i.e. "I > > > drink in the hous

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:07:11 AM UTC-7, MRAB wrote: > On 28/09/2013 18:43, cerr wrote: > > [snip] > > > Great, only I don't have the re module on my system :( > > > > > Really? It's part of Python's standard distribution. O

Re: replace only full words

2013-09-28 Thread cerr
On Saturday, September 28, 2013 11:17:19 AM UTC-7, Tim Chase wrote: > [mercy, you could have trimmed down that reply] > > > > On 2013-09-28 10:43, cerr wrote: > > > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote: > > >> import re > >

extraction tool using CRF++

2013-09-30 Thread cerr
Hi, I want to write an extraction tool using CRF++ (http://crfpp.googlecode.com/svn/trunk/doc/index.html). I have written a trainings file and a template: training: banana FOODB-NP bread FOODI-NP template: U01:%x[0,1] U02:%x[1,1] and now I want to go ahead and extract the foods from a

Re: extraction tool using CRF++

2013-10-01 Thread cerr
On Tuesday, October 1, 2013 3:04:00 PM UTC, Joost Molenaar wrote: > Hi Ron, > > In the python/ subdirectory of the CRF++ source package there's a > > README with instructions on how to use the CRFPP python module. > Joost, Hoops, didn't see that! Yes, Thanks! :) -- https://mail.python.org/mail

Broken pipe

2010-05-06 Thread cerr
Hi There, I'm very new to Python and i wanna write a script that sends a certain string to a server. The code I came up with looks like this: #!/usr/bin/python import sys import string from socket import * usage="USAGE: "+sys.argv[0]+" "; if len(sys.argv) != 3: print usage;

Re: Broken pipe

2010-05-07 Thread cerr
ebert wrote: > > >> On Thu, May 6, 2010 at 10:27 PM, cerr wrote: > > >> > Hi There, > > > >> > I'm very new to Python and i wanna write a script that sends a certain > > >> > string to a server. The code I came up with lo

huh??? weird problem

2010-05-14 Thread cerr
Hi There, I got following code: start=time.time() print 'warnTimeout '+str(WarnTimeout) print 'critTimeout '+str(CritTimeout) print 'start',str(start) while wait: passed = time.time()-start print 'passed ',str(passed) if passed >= WarnTimeout: print ' Warning!' ... ... ... whic

DeprecationWarning

2010-09-01 Thread cerr
Hi There, I would like to create an scp handle and download a file from a client. I have following code: import sys, os, paramiko,time from attachment import SCPClient transport = paramiko.Transport((prgIP, 22)) try: transport.connect(username='root', password=prgPass) except IOError

scp with paramiko

2010-09-01 Thread cerr
Hi There, I want to download a file from a client using paramiko. I found plenty of ressources using google on how to send a file but none that would describe how to download files from a client. Help would be appreciated! Thanks a lot! Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: DeprecationWarning

2010-09-02 Thread cerr
On Sep 1, 5:04 pm, Chris Rebert wrote: > On Wed, Sep 1, 2010 at 8:58 AM, cerr wrote: > > Hi There, > > > I would like to create an scp handle and download a file from a > > client. I have following code: > > > but what i'm getting is this and no file is

Re: DeprecationWarning

2010-09-02 Thread cerr
On Sep 2, 4:25 pm, Chris Rebert wrote: > On Thu, Sep 2, 2010 at 4:19 PM, cerr wrote: > > On Sep 1, 5:04 pm, Chris Rebert wrote: > >> On Wed, Sep 1, 2010 at 8:58 AM, cerr wrote: > >> > Hi There, > > >> > I would like to create an scp handle and

listening socket

2010-09-08 Thread cerr
Hi, I'm trying to create a listening socket connection on port 1514. I tried to follow the documentation at: http://docs.python.org/release/2.5.2/lib/socket-example.html and came up with following lines: import socket host = '' # Symbolic name meaning all available interfaces port

Re: listening socket

2010-09-08 Thread cerr
On Sep 8, 10:06 am, Benjamin Kaplan wrote: > On Wed, Sep 8, 2010 at 12:59 PM, cerr wrote: > > Hi, > > > I'm trying to create a listening socket connection on port 1514. > > I tried to follow the documentation at: > >http://docs.python.org/release/2.5.2/lib/

executing script in fork

2010-09-08 Thread cerr
Hi There, I want to trigger another script and having it running forked to my mother process. I googled around and came up with following: commandlist=['./GPSsim.pl',proto,'files/gps.txt'] subprocess.Popen(commandlist) print "GPS simulator started" This however doesn't seem disconnect stdo

how to kill a subprocess

2010-09-09 Thread cerr
Hi There, I'm calling a python script from a php script which again calls a perl script with subprocess.popen(). This seems to work fine so far only that once the python script completed it is becoming a zombie because the perl script in the background is still running... so before i exit the pyth

Re: how to kill a subprocess

2010-09-09 Thread cerr
On Sep 9, 3:29 pm, Alain Ketterlin wrote: > cerr writes: > > I'm calling a python script from a php script which again calls a perl > > script with subprocess.popen(). > > This seems to work fine so far only that once the python script > > completed it is be

Re: how to kill a subprocess

2010-09-10 Thread cerr
On Sep 9, 4:18 pm, MRAB wrote: > On 09/09/2010 23:52, cerr wrote: > > > > > On Sep 9, 3:29 pm, Alain Ketterlin > > wrote: > >> cerr  writes: > >>> I'm calling a python script from a php script which again calls a perl > >>> script with

Re: how to kill a subprocess

2010-09-10 Thread cerr
On Sep 10, 11:45 am, Christian Heimes wrote: > Am 10.09.2010 19:51, schrieb cerr: > > > Thanks for your suggestion, changed my code now to: > > >   process=subprocess.Popen(commandlist) > >   ... > >   ... > >   process.kill() > >   os.waitpid(process

Re: how to kill a subprocess

2010-09-10 Thread cerr
On Sep 10, 12:18 pm, Christian Heimes wrote: > Am 10.09.2010 20:56, schrieb cerr: > > > But I wanna kill the child process I start from my python code. > > It's like > > PHP -> Python -> Perl > > > and when the connection PHP -> Python seems to work

socket.error: [Errno 98] Address already in use

2010-09-15 Thread cerr
Hi There, I get a socket error "[Errno 98] Address already in use" when i try to open a socket that got closed before with close(). How come close() doesn't close the socket properly? My socket code : s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(1) ...

Re: socket.error: [Errno 98] Address already in use

2010-09-16 Thread cerr
On Sep 15, 5:51 pm, "jipalaciosort...@gmail.com" wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > El 15/09/2010 20:58, Grant Edwards escribió: > > > > > On 2010-09-15, cerr wrote: > > >> I get a socket error "[Errno 98] Address

Re: socket.error: [Errno 98] Address already in use

2010-09-16 Thread cerr
On Sep 15, 11:58 am, Grant Edwards wrote: > On 2010-09-15, cerr wrote: > > > > > > > I get a socket error "[Errno 98] Address already in use" when i try to > > open a socket that got closed before with close(). How come close() > > doesn&#

upload file using post to https server

2010-09-23 Thread cerr
hi, I've been unsucessfully trying to upload a file using POST to an https server. I've succesfully logged in and gotten to read something from the server.. I have come up with something like this: authinfo = urllib2.HTTPBasicAuthHandler() authinfo.add_password(realm='Configurati