RERP 0.8.0, an alternative robots.txt parser

2006-06-12 Thread Philip Semanchuk
RERP (Robot Exclusion Rules Parser) is an alternative to Python's standard robotparser module. I was motivated to write this because the Python's robotparser doesn't gracefully handle non-ASCII which occurs in about .1% of robots.txt files. This module (RERP) handles non-ASCII and also adds a

ANNOUNCE: new package posix_ipc 0.1 available

2008-10-10 Thread Philip Semanchuk
The package posix_ipc provides a Python interface to POSIX shared memory and named semaphores on platforms that support them (i.e. most Unices). Platform details, source code, sample code and usage instructions are provided at the link below. This package is GPLed.

ANN: posix_ipc 0.7.0 available

2010-02-22 Thread Philip Semanchuk
posix_ipc 0.7.0 is now available. This is the first version to include Python 3 support. http://semanchuk.com/philip/posix_ipc/ Enjoy Philip -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation:

ANN: sysv_ipc 0.6 now available

2010-05-21 Thread Philip Semanchuk
sysv_ipc 0.6 is now available. This is the first version to include Python 3 support. sysv_ipc is a BSD-licensed module which gives Python access to System V inter-process semaphores, shared memory and message queues on most (all?) *nix flavors, and possibly Windows + Cygwin.

Re: Python shell scripting and errors

2009-02-23 Thread Philip Semanchuk
On Feb 23, 2009, at 12:21 PM, Tim Wintle wrote: On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: I've got a python script running as a daemon (using someone else's daemon module). It runs fine for a while, but will occasionally balk and die. Since its running in the background, I'm

Re: Python C-API Object Allocation

2009-02-23 Thread Philip Semanchuk
On Feb 21, 2009, at 10:01 AM, William Newbery wrote: Ive been learning the C-API lately so I can write python extensions for some of my c++ stuff. I want to use the new and delete operators for creating and destroying my objects. The problem is python seems to break it into several

Re: python sql query in django

2009-02-23 Thread Philip Semanchuk
On Feb 23, 2009, at 4:34 PM, Diez B. Roggisch wrote: I may not stay with Django. I am seriously looking for whether python can read data from a relational database and send to an html template or do I always need some kind of wrapper/interface such as Rails or Django? If this is the wrong

Re: PYTHONPATH on Mac 10.5

2009-02-25 Thread Philip Semanchuk
On Feb 25, 2009, at 3:20 PM, Vincent Davis wrote: I have looked around for a good howto setup PYTHONPATH on Mac os x 10.5 Although I get many results I am not sure which is correct. I am not sure if it is different for 10.5 over previous versions. Does anyone know of a well documented set

Re: Characters aren't displayed correctly

2009-03-01 Thread Philip Semanchuk
On Mar 1, 2009, at 8:31 AM, Hussein B wrote: Hey, I'm retrieving records from MySQL database that contains non english characters. Then I create a String that contains HTML markup and column values from the previous result set. + markup = u'''table.''' for row in rows: markup =

Re: Characters aren't displayed correctly

2009-03-02 Thread Philip Semanchuk
On Mar 2, 2009, at 9:50 AM, Hussein B wrote: On Mar 2, 4:31 pm, John Machin sjmac...@lexicon.net wrote: On Mar 2, 7:30 pm, Hussein B hubaghd...@gmail.com wrote: On Mar 1, 4:51 pm, Philip Semanchuk phi...@semanchuk.com wrote: What are you getting out of the database? Is it being converted

Re: Characters aren't displayed correctly

2009-03-02 Thread Philip Semanchuk
On Mar 2, 2009, at 10:50 AM, John Machin wrote: On Mar 3, 2:22 am, Philip Semanchuk phi...@semanchuk.com wrote: See if you can successfully construct and send an email that says Hello world in English/ASCII. If that works, change it to Arabic. If that works, change the email format to HTML

Re: Characters aren't displayed correctly

2009-03-02 Thread Philip Semanchuk
On Mar 2, 2009, at 5:26 PM, John Machin wrote: On Mar 3, 3:27 am, Philip Semanchuk phi...@semanchuk.com wrote: He claims to have done what I asked him to do in the first place -- break the problem into steps and verify the database steps. He says they're working OK. I chose to take him at his

Re: looking for template package

2009-03-03 Thread Philip Semanchuk
On Mar 3, 2009, at 9:06 PM, Neal Becker wrote: I'm looking for something to do template processing. That is, transform text making various substitutions. I'd like to be able to do substitutions that include python expressions, to do arithmetic computations within substitutions. I know

Re: Parsing/Crawler Questions..

2009-03-04 Thread Philip Semanchuk
On Mar 4, 2009, at 4:44 PM, bruce wrote: Hi... Sorry that this is a bit off track. Ok, maybe way off track! But I don't have anyone to bounce this off of.. I'm working on a crawling project, crawling a college website, to extract course/class information. I've built a quick test app in

Re: Parsing/Crawler Questions..

2009-03-05 Thread Philip Semanchuk
On Mar 5, 2009, at 12:31 PM, bruce wrote: hi.. the url i'm focusing on is irrelevant to the issue i'm trying to solve at this time. Not if we're to understand the situation you're trying to describe. From what I can tell, you're saying that the target site displays different results

Re: Decorators

2009-03-06 Thread Philip Semanchuk
On Mar 6, 2009, at 9:13 AM, Michiel Overtoom wrote: Johnny wrote... Can anyone explain to me what are decorators for? What are advantages of using them? A tutorial article about decorators from Bruce Eckel: http://www.artima.com/weblogs/viewpost.jsp?thread=240808 Thanks for that,

Re: unbiased benchmark

2009-03-12 Thread Philip Semanchuk
On Mar 12, 2009, at 4:20 PM, Daniel Fetchinson wrote: Even more amazingly, it takes approximately 30% less time to say 'ruby' than to say 'python'!!! But python scores 55% more points than ruby in Scrabble, so that's understandable. It also explains why both languages are much better

Re: Getting final url when original url redirects

2009-03-12 Thread Philip Semanchuk
On Mar 12, 2009, at 3:57 PM, IanR wrote: I'm processing RSS content from a # of given sources. Most of the time the url given by the RSS feed redirects to the real URL (I'm guessing they do this for tracking purposes) For example. This is a url that I get from and RSS feed,

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Philip Semanchuk
On Mar 17, 2009, at 10:04 AM, Laszlo Nagy wrote: This is a long running process, written in Python. Only standard lib is used. This process accepts connections on TCP sockets, read/write data. After about one day, it starts throwing this when I try to connect: 2009-03-17 09:49:50,096

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Philip Semanchuk
On Mar 17, 2009, at 10:31 AM, Laszlo Nagy wrote: Hi Laszlo, Just a hunch -- are you leaking file handles and eventually running out? These file handles are for TCP sockets. They are accept()-ed, used and then thrown out. I guess after the connection was closed, the file handle is

Re: Python + PostgreSQL

2009-03-17 Thread Philip Semanchuk
On Mar 17, 2009, at 12:46 PM, Lobo wrote: Hi, I am new to this newsgroup (and new to Python and PostgreSQL). My experience (17+ years) has been with Smalltalk (e.g. VAST) and Object databases (e.g. Versant, OmniBase). I now have a new project to develop web applications using the latest/

Re: Python + PostgreSQL

2009-03-17 Thread Philip Semanchuk
Python 3.x without problems?. Or should I just use Python 2.6?. What would you recommend?. Many thanks again, Carlos On Mar 17, 12:20 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Mar 17, 2009, at 12:46 PM, Lobo wrote: Hi, I am new to this newsgroup (and new to Python and PostgreSQL

Re: Compiling modules in OSX, eg PyUSB?

2009-03-20 Thread Philip Semanchuk
On Mar 20, 2009, at 9:48 AM, Dr Mephesto wrote: Hi, I am using Leopard and MacPython, and I would like to access a USB device. I have installed libusb, and now I have tried to compile PyUSB from: http://sourceforge.net/projects/pyusb/ But when I compile I get lots of errors, ie: Hi Dr. M.,

Re: Compiling modules in OSX, eg PyUSB?

2009-03-20 Thread Philip Semanchuk
On Mar 20, 2009, at 11:39 AM, Dr Mephesto wrote: Thanks. I found some more info that might help, if I understood it :)From the main PyUSB page, at http://pyusb.berlios.de/ , its says: PyUSB uses the libusb to do its work, so, any system which has Python and libusb should work for PyUSB.

Re: Compiling modules in OSX, eg PyUSB?

2009-03-20 Thread Philip Semanchuk
On Mar 20, 2009, at 12:36 PM, Dr Mephesto wrote: windows? well, I thought that maybe the location of the usb.h thing was relevant, and I didnt see it mentioned on the linux instructions. Oh, OK. Windows is a pretty different animal from Unix/Linux so it's not likely to be of much help

Re: Compiling modules in OSX, eg PyUSB?

2009-03-21 Thread Philip Semanchuk
On Mar 21, 2009, at 2:49 AM, Dr Mephesto wrote: On Mar 20, 6:23 pm, Philip Semanchuk phi...@semanchuk.com wrote: So change line 32 in the PyUSB setup.py from this: extra_compile_args = ['-I/sw/include'] to this: extra_compile_args = ['-I/sw/include', '-I/usr/local/include

Python version(s) for new project?

2009-03-26 Thread Philip Semanchuk
Hi all, I'm about to start a new job at which I and others will build a project largely in Python. I'm trying to figure out which Python versions to use and support. I can't use Python 3.x, but I want to prepare for it even if it is a long way off yet. My idea is to use Python 2.6 on my

Re: Python version(s) for new project?

2009-03-26 Thread Philip Semanchuk
On Mar 26, 2009, at 10:34 AM, andrew cooke wrote: Philip Semanchuk wrote: Hi all, I'm about to start a new job at which I and others will build a project largely in Python. I'm trying to figure out which Python versions to use and support. I can't use Python 3.x, but I want to prepare

Re: mmap resizing macosx unix

2009-04-05 Thread Philip Semanchuk
On Apr 5, 2009, at 10:28 AM, David Pratt wrote: Hi. I have been experimenting with mmap recently. I determined how to read and write properly from it and so search and replace on large files. The problem I am having is with replaces that are larger than the mmap. In this instance I need

Re: Open source web crawler with mysql integration

2009-04-09 Thread Philip Semanchuk
On Apr 9, 2009, at 7:37 PM, Daniel Fetchinson wrote: I'm looking for a crawler that can spider my site and toss the results into mysql so, in turn, that database can be indexed by Sphinx Search. Since I don't want to reinvent the wheel, is anyone aware of any open source projects or code

Re: Open source web crawler with mysql integration

2009-04-10 Thread Philip Semanchuk
. I'd love to open source it and if someone wants to pay me to make it open source-able, let's talk! But if I have to do it on my own time for free it will be a while (maybe never, although I hope not) before I can make the time. Regards Philip -Original Message- From: Philip

Re: Open source web crawler with mysql integration

2009-04-10 Thread Philip Semanchuk
source in general, but I'm more concerned about me. ;) -Original Message- From: python-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of Philip Semanchuk Sent: Friday, April 10, 2009 8:10 AM To: Python (General

Re: Open source web crawler with mysql integration

2009-04-10 Thread Philip Semanchuk
On Apr 10, 2009, at 10:37 PM, Lawrence D'Oliveiro wrote: In message mailman.3655.1239380993.11746.python-l...@python.org, Philip Semanchuk wrote: I'd love to open source it and if someone wants to pay me to make it open source-able, let's talk! Nobody's going to pay you for something

Re: Registering Cron using CronTab

2009-04-17 Thread Philip Semanchuk
On Apr 17, 2009, at 9:51 AM, gurcharan.sa...@gmail.com wrote: Hi I'm developing a Django application which is running on Apache. We need to add crontab from the Python script and we are using Python CronTab package http://pypi.python.org/pypi/python-crontab/0.7 for this. I'm stuck with the

ANNOUNCE: new package posix_ipc 0.1 available

2008-10-09 Thread Philip Semanchuk
The package posix_ipc provides a Python interface to POSIX shared memory and named semaphores on platforms that support them (i.e. most Unices). Platform details, source code, sample code and usage instructions are provided at the link below. This package is GPLed.

Re: parsing javascript

2008-10-12 Thread Philip Semanchuk
On Oct 12, 2008, at 5:25 AM, S.Selvam Siva wrote: I have to do a parsing on webpagesand fetch urls.My problem is ,many urls i need to parse are dynamically loaded using javascript function (onload()).How to fetch those links from python? Thanks in advance. Selvam, You can try to find them

Re: Reg: Installation problems in psycopg2

2008-10-13 Thread Philip Semanchuk
On Oct 13, 2008, at 11:52 PM, [EMAIL PROTECTED] wrote: Hi all, I am not sure whether this is the right place to ask this question. Please let me know if it isn't. The psycopg mailing list would be a better place to ask. I am trying to install psycopg2 in my windows machine for

Re: urllib accept-language doesn't have any effect

2008-10-15 Thread Philip Semanchuk
On Oct 15, 2008, at 9:50 AM, Martin Bachwerk wrote: Hello, I'm trying to load a couple of pages using the urllib2 module. The problem is that I live in Germany and some sites seem to look at the IP of the client and forward him to a localized page.. Here's an example of the code, how I

Re: urllib accept-language doesn't have any effect

2008-10-16 Thread Philip Semanchuk
On Oct 16, 2008, at 6:50 AM, Martin Bachwerk wrote: Hmm, thanks for the ideas, I've checked the requests in Firefox one more time after deleting all the cookies and both google.com and gizmodo.com do indeed forward me to the German site without caring about the browser settings. wget

Re: regular expression question (re module)

2008-10-16 Thread Philip Semanchuk
On Oct 16, 2008, at 11:25 PM, Steve Holden wrote: Pat wrote: Faheem Mitha wrote: Hi, I need to match a string of the form capital_letter underscore capital_letter number against a string of the form anything capital_letter underscore capital_letter number some_stuff_not_starting with a

Re: crossplatform standalone python apps

2008-10-17 Thread Philip Semanchuk
On Oct 17, 2008, at 2:59 AM, Gabriel Rossetti wrote: Hello everyone, I like to create a cross-platform standalone python application, like Mac OS *.app dirs. The idea is to distribute a zip file containing everything (the python interpreter and all) so that a user just unzips it and

Re: Script can't find input file despite being in the same directory

2008-10-17 Thread Philip Semanchuk
On Oct 17, 2008, at 1:07 PM, Robocop wrote: I have a simple little script that reads in postscript code, appends it, then writes it to a new postscript file. Everything worked fine a month ago, but after rearranging my directory tree a bit my script fails to find the base postscript file.

Re: urllib2.HTTPError: HTTP Error 204: NoContent

2008-10-19 Thread Philip Semanchuk
On Oct 19, 2008, at 6:13 AM, silk.odyssey wrote: I am getting the following error trying to download an html page using urllib2. urllib2.HTTPError: HTTP Error 204: NoContent The url is of this type:

Re: Error

2008-10-21 Thread Philip Semanchuk
On Oct 21, 2008, at 9:05 AM, Amie wrote: Hi, what does is the meaning of this error: int object is unsubscriptable. This is the code that I have written that seems to give me that: def render_sideMenu(self, ctx, data): def render_dataAge(unit): results = [(i[0], i[1] ) for i

Re: Python 2.6, multiprocessing module and BSD

2008-10-21 Thread Philip Semanchuk
On Oct 21, 2008, at 6:45 PM, [EMAIL PROTECTED] wrote: It seems that the multiprocessing module in 2.6 is broken for *BSD; I've seen issue 3770 regarding this. I'm curious if there are more details on this issue since the posts in 3770 were a bit unclear. For example, one post claimed that the

Re: Python 2.6, multiprocessing module and BSD

2008-10-22 Thread Philip Semanchuk
On Oct 22, 2008, at 10:11 AM, Jesse Noller wrote: On Tue, Oct 21, 2008 at 6:45 PM, [EMAIL PROTECTED] wrote: It seems that the multiprocessing module in 2.6 is broken for *BSD; I've seen issue 3770 regarding this. I'm curious if there are more details on this issue since the posts in 3770

Re: Python 2.6, multiprocessing module and BSD

2008-10-22 Thread Philip Semanchuk
On Oct 22, 2008, at 11:37 AM, Jesse Noller wrote: On Wed, Oct 22, 2008 at 11:06 AM, Philip Semanchuk [EMAIL PROTECTED] wrote: One oversight I noticed the multiprocessing module docs is that a semaphore's acquire() method shouldn't have a timeout on OS X as sem_timedwait() isn't supported

Passing a memory address (pointer) to an extension?

2008-10-22 Thread Philip Semanchuk
I'm writing a Python extension in C that wraps a function which takes a void * as a parameter. (The function is shmat() which attaches a chunk of shared memory to the process at the address supplied by the caller.) I would like to expose this function to Python, but I don't know how to

Re: How to import from a file which is not in the current directory?

2008-10-22 Thread Philip Semanchuk
On Oct 22, 2008, at 5:38 PM, Kurda Yon wrote: Hi, I would like to import a function from a file which is located not in the same directory as the main program (from which the function needed to be imported). Could anybody pleas tell me how to do that? Python will search for module files in

Re: Passing a memory address (pointer) to an extension?

2008-10-23 Thread Philip Semanchuk
On Oct 22, 2008, at 8:33 PM, Robert Kern wrote: Philip Semanchuk wrote: I'm writing a Python extension in C that wraps a function which takes a void * as a parameter. (The function is shmat() which attaches a chunk of shared memory to the process at the address supplied by the caller.) I

Re: Passing a memory address (pointer) to an extension?

2008-10-23 Thread Philip Semanchuk
On Oct 23, 2008, at 2:13 AM, Thomas Heller wrote: Philip Semanchuk schrieb: I'm writing a Python extension in C that wraps a function which takes a void * as a parameter. (The function is shmat() which attaches a chunk of shared memory to the process at the address supplied by the caller.) I

Re: python extensions: including project local headers

2008-10-23 Thread Philip Semanchuk
On Oct 23, 2008, at 11:36 AM, J Kenneth King wrote: Hey everyone, I'm working on a python extension wrapper around Rob Hess' implementation of a SIFT feature detector. I'm working on a computer-vision based project that requires interfacing with Python at the higher layers, so I figured the

Re: python extensions: including project local headers

2008-10-23 Thread Philip Semanchuk
On Oct 23, 2008, at 3:18 PM, J Kenneth King wrote: Philip Semanchuk [EMAIL PROTECTED] writes: On Oct 23, 2008, at 11:36 AM, J Kenneth King wrote: Hey everyone, I'm working on a python extension wrapper around Rob Hess' implementation of a SIFT feature detector. I'm working on a computer

Re: 2.6, 3.0, and truly independent intepreters

2008-10-25 Thread Philip Semanchuk
On Oct 25, 2008, at 7:53 AM, Michael Sparks wrote: Glenn Linderman wrote: In the module multiprocessing environment could you not use shared memory, then, for the large shared data items? If the poshmodule had a bit of TLC, it would be extremely useful for this, since it does

Re: Finding Default Page Name using urllib2

2008-10-27 Thread Philip Semanchuk
On Oct 27, 2008, at 12:17 PM, barrett wrote: Is there a way to find the name of a page you are retrieving using python. For example, if I get http://www.cnn.com/ i want to know that the page is index.html. I can do this using wget. as seen in the code below. Can I do this in python? Hi

Re: httplib raises ValueError reading chunked content

2006-03-08 Thread Philip Semanchuk
On Mar 8, 2006, at 8:32 PM, Etienne Desautels wrote: Hi Philip, Hi all, Has anyone ever seen Python 2.4.1's httplib choke when reading chunked content? Yes, it's a know bug. See for yourself: https://sourceforge.net/tracker/? func=detailatid=305470aid=900744group_id=5470 Merci

Re: Where to locate existing standard encodings in python

2008-11-09 Thread Philip Semanchuk
On Nov 9, 2008, at 7:00 PM, News123 wrote: Hi, I was googling quite some time before finding the answer to my question: 'what are the names for the encodings supported by python?' I found the answer at http://python.active-venture.com/lib/ node127.html Now my question: Can I find the

Re: Where to locate existing standard encodings in python

2008-11-11 Thread Philip Semanchuk
.py files located there. Yes, I'd thought about this but I agree with you that it seems unpythonic and fragile. Unfortunately I can't think of anything better at this point. Good luck Philip Philip Semanchuk wrote: On Nov 11, 2008, at 9:10 AM, News123 wrote: Hi Philip, Your answer

Re: Where to locate existing standard encodings in python

2008-11-11 Thread Philip Semanchuk
. For that reason I can't say more about how it works. You may want to experiment to see if encodings added via codecs.register() show up in the encodings.aliases.aliases dict. Have fun Philip Philip Semanchuk wrote: On Nov 9, 2008, at 7:00 PM, News123 wrote: Hi, I was googling quite

Re: running same script on same data on two different machines -- different result

2008-11-14 Thread Philip Semanchuk
On Nov 14, 2008, at 10:14 AM, Christopher Brewster wrote: I am running the same script on the same data on two different machines (the folder is synchronised with Dropbox). I get two different results. All the script does is count words in different files and perform a simple set operation on

Re: web site feedback page using python for sending email

2008-11-14 Thread Philip Semanchuk
On Nov 14, 2008, at 1:48 PM, KAM.covad wrote: Here is a great reference: http://www.thinkspot.net/sheila/staticpages/index.php?page=gypsymail However, the code will not work for an SMTP site like gmail that requires authentication. Anyone know of a site that has that code? I am a nube with

Re: Installing Python2.6 on Mac Os (Leopard)

2008-11-17 Thread Philip Semanchuk
On Nov 17, 2008, at 10:53 AM, Massi wrote: Hi everyone, I'm trying to install Python2.6 on my mac (Leopard 10.5.5), but I'm encountering some problems. To install the package I followed the instructions I found at this link: http://wiki.python.org/moin/MacPython/Leopard If I open wing, it

Re: Installing Python2.6 on Mac Os (Leopard)

2008-11-17 Thread Philip Semanchuk
On Nov 17, 2008, at 1:17 PM, Diez B. Roggisch wrote: Philip Semanchuk wrote: On Nov 17, 2008, at 10:53 AM, Massi wrote: Hi everyone, I'm trying to install Python2.6 on my mac (Leopard 10.5.5), but I'm encountering some problems. To install the package I followed the instructions I

Re: Installing Python2.6 on Mac Os (Leopard)

2008-11-17 Thread Philip Semanchuk
On Nov 17, 2008, at 2:05 PM, Diez B. Roggisch wrote: Sorry if I misinformed; I have such symlinks in /usr/local/bin dated the same day as my custom Python install. I guess I could have created them myself, but I don't think I would have bothered creating a symlink for pythonw, for example

Re: Programming exercises/challenges

2008-11-19 Thread Philip Semanchuk
On Nov 19, 2008, at 7:12 AM, Mr.SpOOn wrote: On Wed, Nov 19, 2008 at 2:39 AM, Mensanator [EMAIL PROTECTED] wrote: Another hobby I have is tracking movie box-office receipts (where you can make interesting graphs comparing Titanic to Harry Potter or how well the various sequels do, if Pierce

Re: calling python scripts as a sub-process

2008-11-19 Thread Philip Semanchuk
On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: The command (stored as an array of strings) that I'm executing is: ['python ../src_python/Match1.py ', '-- file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_BF_F03_0024.hdf ',

Re: Python C/API simple debugging

2008-11-26 Thread Philip Semanchuk
On Nov 26, 2008, at 6:47 AM, k3xji wrote: By the way for simple print-debugging, below works right now, I forgot to try that fprintf(stderr,%d, key); As a new extension developer myself, I'll pass along the following handy macro that I swiped from another extension (psycopg I think):

Re: setting path for python interpretor

2008-11-28 Thread Philip Semanchuk
On Nov 28, 2008, at 6:41 AM, Beema Shafreen wrote: Hi all, Can any body suggest me how to the set path for making python2.4 as the main interpretor instead of python 2.5. Hi Beema, This question is about your operating system, not about Python. On my system (OS X), having installed

Re: Running a Python script from crontab

2008-12-02 Thread Philip Semanchuk
On Dec 2, 2008, at 9:35 AM, Astley Le Jasper wrote: I need help ... I've been looking at this every evening for over a week now. I'd like to see my kids again! I have script that runs fine in the terminal but when I try to run it in a crontab for either myself or root, it bails out. The

Re: Best way to run multiple Python processes without overloading CPU or disk i/o

2008-12-02 Thread Philip Semanchuk
On Dec 2, 2008, at 11:21 PM, [EMAIL PROTECTED] wrote: Is there a cross-platform way to launch multiple Python processes and monitor CPU usage os.getloadavg() might be useful. It certainly works on *nix, don't know about Windows. The documentation doesn't mention any platform limitations.

Re: Running a Python script from crontab

2008-12-03 Thread Philip Semanchuk
On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote: I've included a switch to include or exclude the logging to console. When logging only to file, the script runs fine. Of course, I still don't understand why dual logging, and specifically to the console, causes a problem and if anyone has

Re: Running a Python script from crontab

2008-12-03 Thread Philip Semanchuk
On Dec 3, 2008, at 1:33 PM, Astley Le Jasper wrote: On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote: On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote: I've included a switch to include or exclude theloggingto console. Whenloggingonly to file, the script runs fine. Of course

Re: Running a Python script from crontab

2008-12-03 Thread Philip Semanchuk
On Dec 3, 2008, at 3:06 PM, Astley Le Jasper wrote: On 3 Dec, 19:49, Philip Semanchuk [EMAIL PROTECTED] wrote: On Dec 3, 2008, at 1:33 PM, Astley Le Jasper wrote: On 3 Dec, 16:41, Philip Semanchuk [EMAIL PROTECTED] wrote: On Dec 3, 2008, at 10:29 AM, Astley Le Jasper wrote: I've

Re: Running a Python script from crontab

2008-12-04 Thread Philip Semanchuk
On Dec 4, 2008, at 4:21 AM, Astley Le Jasper wrote: On Dec 4, 12:34 am, Lawrence D'Oliveiro [EMAIL PROTECTED] central.gen.new_zealand wrote: In message [EMAIL PROTECTED], Philip Semanchuk wrote: In my experience, the environment in which a cron job runs is different from the environment

Re: Source code generation using Python

2008-12-06 Thread Philip Semanchuk
On Dec 6, 2008, at 4:47 PM, ats wrote: Hello, This is my first posting to a Python group (and I'm starting with Python seriously only now) , so bear with me if I make some mistakes. I want to generate 3 different versions of a C++ source code, basically injecting different flavours of inline

Re: Best way to run multiple Python processes without overloading CPU or disk i/o

2008-12-08 Thread Philip Semanchuk
On Dec 8, 2008, at 2:48 AM, Gabriel Genellina wrote: En Wed, 03 Dec 2008 02:29:32 -0200, Philip Semanchuk [EMAIL PROTECTED] escribió: On Dec 2, 2008, at 11:21 PM, [EMAIL PROTECTED] wrote: Is there a cross-platform way to launch multiple Python processes and monitor CPU usage

Re: When (and why) to use del?

2008-12-09 Thread Philip Semanchuk
On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del

Re: When (and why) to use del?

2008-12-10 Thread Philip Semanchuk
On Dec 10, 2008, at 5:23 PM, Gabriel Genellina wrote: En Tue, 09 Dec 2008 15:29:17 -0200, Philip Semanchuk [EMAIL PROTECTED] escribió: On Dec 9, 2008, at 11:35 AM, Albert Hopkins wrote: def myfunction(): # do some stuff stuff my_string

Re: Parallelizing python code - design/implementation questions

2008-12-13 Thread Philip Semanchuk
On Dec 13, 2008, at 7:00 AM, stdazi wrote: Hello! I'm about to parallelize some algorithm that turned out to be too slow. Before I start doing it, I'd like to hear some suggestions/hints from you. Hi stdazi, If you're communicating between multiple processes with Python, you might find my

Re: changing string encoding to different charset?

2008-12-14 Thread Philip Semanchuk
On Dec 14, 2008, at 9:21 AM, Daniel Woodhouse wrote: Is it possible to re-encode a string to a different character set in python? To be more specific, I want to change a text file encoded in windows-1251 to UTF-8. I've tried using string.encode, but get the error: UnicodeDecodeError: 'ascii'

Re: Thread Locking issue - Can't allocate lock (sem_init fail)

2008-12-15 Thread Philip Semanchuk
On Dec 15, 2008, at 4:56 AM, jams...@googlemail.com wrote: Hi all, I have a peculiar problem with a multithreaded program of mine (actually I've sort of inherited it). Before i show you the error, here's a litle background. Its a program to check email addresses are valid, and its main task

Re: Are Django/Turbogears too specific?

2008-12-21 Thread Philip Semanchuk
On Dec 21, 2008, at 2:41 PM, Gilles Ganault wrote: Hi I'd like to rewrite a Web 2.0 PHP application in Python with AJAX, and it seems like Django and Turbogears are the frameworks that have the most momentum. I don't have any practical experience with these, but I've done some research.

Re: Are Django/Turbogears too specific?

2008-12-21 Thread Philip Semanchuk
On Dec 21, 2008, at 3:14 PM, Bruno Desthuilliers wrote: Philip Semanchuk a écrit : (snip) From the reading I did, I gathered that Django was really good if you want to do what Django is good at, but not as easy to customize as, say, Pylons. That was my first impression too, and was more

Re: Are Django/Turbogears too specific?

2008-12-22 Thread Philip Semanchuk
On Dec 22, 2008, at 1:52 AM, Tino Wildenhain wrote: Philip Semanchuk wrote: ... I prefer Mako over the other template languages I've seen. From what I can tell Mako is nearly identical to all other template languages you might have seen (e.g. PHP style tags). Thats why I personally would

Re: SQL, lite lite lite

2008-12-29 Thread Philip Semanchuk
On Dec 29, 2008, at 1:06 PM, Aaron Brady wrote: I don't think relational data can be read and written very easily in Python. There are some options, such as 'sqllite3', but they are not easy. 'sqllite3' statements are valid SQL expressions, which afford the entire power of SQL, but contrary

Re: multiprocessing vs thread performance

2008-12-31 Thread Philip Semanchuk
On Dec 31, 2008, at 7:19 PM, Paul Rubin wrote: Aaron Brady castiro...@gmail.com writes: I had an idea. You could use 'multiprocessing' for synchronization, and just use an mmap for the actual communication. (I think it's a good idea.) Are you reinventing POSH?

Re: How to declare python ints in C extensions?

2009-01-04 Thread Philip Semanchuk
On Jan 4, 2009, at 1:20 PM, Tony Houghton wrote: I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than

Re: pep-8 vs. external interfaces?

2009-01-06 Thread Philip Semanchuk
On Jan 4, 2009, at 2:47 PM, Roy Smith wrote: I'm building a Python language wrapper to an network protocol which traditionally uses camelCase function names. I'm trying to make the new code pep-8 compliant, which means function names should be written this_way() instead of thisWay(). I've

Re: having problems with a multi-conditional while statement

2009-01-06 Thread Philip Semanchuk
On Jan 6, 2009, at 7:18 PM, bowman.jos...@gmail.com wrote: Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2:

Re: mac osx how to use a specific python environment

2009-01-07 Thread Philip Semanchuk
On Jan 7, 2009, at 7:27 AM, marco kuhn wrote: hi, I would like to use a specific python environment in a script . The script is load as a plugin by a program which offer a python api . The python environment is build in. How can I use the standard python environment. Can i explicit load the

Re: Is it ok to type check a boolean argument?

2009-01-07 Thread Philip Semanchuk
On Jan 7, 2009, at 12:24 PM, Adal Chiriliuc wrote: Hello, Me and my colleagues are having an discussion about the best way to code a function (more Pythonic). Here is the offending function: def find(field, order): if not isinstance(order, bool): raise ValueError(order must be a

Re: Python Imaging Library and textmate

2009-01-09 Thread Philip Semanchuk
On Jan 9, 2009, at 2:49 AM, bilgin arslan wrote: Hello, I am a beginner in python and I am trying to create image files that contain lines from a text file. I am trying to do this with PIL, which seems like a suitable tool. I have a copy of TextMate(1.5.8) and I run Macosx 10.5.6 The

Re: Python Imaging Library and textmate

2009-01-09 Thread Philip Semanchuk
On Jan 9, 2009, at 12:19 PM, bilgin arslan wrote: Hi Philip, I tried to install PIL with the directions given and it seemed to be ok. When I tried it with IDLE, import Image did not give an error and as far as I checked it seemed to be working. However, importing Image module in TextMate

Re: if-else statement

2009-01-10 Thread Philip Semanchuk
On Jan 10, 2009, at 9:26 AM, Duncan Booth wrote: Gandalf goldn...@gmail.com wrote: other languages like PHP or javascript as this if-else operator like this myVar = checking == 1? 'string': 'other string' is this stuff exist in python? See

Re: urllib2 - 403 that _should_ not occur.

2009-01-11 Thread Philip Semanchuk
On Jan 11, 2009, at 8:59 PM, James Mills wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml ) Traceback (most recent call last): File stdin, line 1, in module File

Re: urllib2 - 403 that _should_ not occur.

2009-01-11 Thread Philip Semanchuk
On Jan 11, 2009, at 10:05 PM, James Mills wrote: On Mon, Jan 12, 2009 at 12:58 PM, Philip Semanchuk phi...@semanchuk.com wrote: On Jan 11, 2009, at 8:59 PM, James Mills wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com/group

Re: urllib2 - 403 that _should_ not occur.

2009-01-12 Thread Philip Semanchuk
On Jan 12, 2009, at 6:48 PM, ajaksu wrote: On Jan 11, 11:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml ) Traceback (most recent

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 1:22 AM, Steve Holden wrote: Philip Semanchuk wrote: On Jan 12, 2009, at 6:48 PM, ajaksu wrote: On Jan 11, 11:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 11:25 AM, Laszlo Nagy wrote: I would like to develop some module for Python for IPC. Socket programming howto recommends that for local communication, and I personally experienced problems with TCP (see my previous post: Slow network). I was looking for semaphores

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 12:40 PM, Laszlo Nagy wrote: The only reason to use shm over the sysv_ipc module is that shm supports versions of Python 2.5. I'm not developing shm any further, so avoid using it if possible. Hmm, we are using FreeBSD, Ubuntu and Windows. Unfortunately - posix_ipc

  1   2   3   4   >