Making a Unix daemon process (was: Forking into the background (Linux))

2012-12-23 Thread Ben Finney
Hans Mulder writes: > On 24/12/12 01:50:24, Olive wrote: > > My goal is to write a script that 1) write something to stdout; then > > fork into the background, closing the stdout (and stderr, stdin) pipe. > > > > I have found this answer (forking -> setsid -> forking) > > http://stackoverflow.co

?????? compile python 3.3 with bz2 support

2012-12-23 Thread Isml
Finally I worked it out. I write it down Here to people who meet the same problem like me. 1. Install bzip2 from source is OK 2. There is no need to add "--with-bz2" to "./configure", because it is not a valid param. python makefile will search the bz2 itself, if it find the bz2 lib, it will a

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Dave Angel
On 12/23/2012 04:42 PM, prilisa...@googlemail.com wrote: > Okay, I try to publish this sample, and yes it's not a working piece of code, > but I try to "draw" my problem that way. As you will see, I load modules, > create cursor,... in the main.py. In the lower section you see, that the > module

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Thomas Bach
Hi there, On Sun, Dec 23, 2012 at 01:42:14PM -0800, prilisa...@googlemail.com wrote: > […] In the lower section you see, that the modules should execute > sqls. In case It could occur that two queries occur at the same > time. PS: IT IS NOT A QUESTION ABOUT SQL, etc. I do not understand, > how I

Re: HTML - WEB FORM running PYTHON SCRIPT

2012-12-23 Thread llanitedave
I'll second this. Javascript is pretty comparable to Python in ease of learning, so that should be no obstacle. As for keeping the code from being accessible, you can put the javascript in a separate file that's called from the guest's web page, but that's far from a foolproof method. If you

Re: Parsing files in python

2012-12-23 Thread Chris Angelico
On Mon, Dec 24, 2012 at 12:46 PM, Terry Reedy wrote: >> snapOffset("Closet-S1_r1", "Closet-S2_r3", <0,0,0>) > > > Already legal Python > Not quite. This is the one part that *doesn't* work directly. In POV-Ray, a vector eg is used to represent points, transformations, and sometimes colors. The c

?????? compile python 3.3 with bz2 support

2012-12-23 Thread Isml
Thanks for your reply.According to your advice, I tried again, but still failed. Here is how I do this time: 1. I did not find package "libbz2-dev" in my source, so I still install it from source 2. I carefully checked the output of "./confiruge" this time and find a warning : "configure: WARNIN

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread iMath
在 2012年12月24日星期一UTC+8上午8时34分47秒,iMath写道: > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ but how to let python do it for you ? such as these 2 pages http://python.org/ http://msdn.microsoft.com/en-us/library/bb802962(v=office.12).a

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread iMath
在 2012年12月24日星期一UTC+8上午8时34分47秒,iMath写道: > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ but how to let python do it for you ? such as these 2 pages http://python.org/ http://msdn.microsoft.com/en-us/library/bb802962(v=office.12).a

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread iMath
在 2012年12月24日星期一UTC+8上午8时34分47秒,iMath写道: > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ but how to let python do it for you ? such as this page http://python.org/ how to detect the character encoding in this web page by python ?

Password hash

2012-12-23 Thread Robert Montgomery
I am writing a script that will send an email using an account I set up in gmail. It is an smtp server using tls on port 587, and I would like to use a password hash in the (python) script for login rather than plain text. Is this do-able? Details please. -- http://mail.python.org/mailman/listinf

Re: Forking into the background (Linux)

2012-12-23 Thread Hans Mulder
On 24/12/12 01:50:24, Olive wrote: > My goal is to write a script that 1) write something to stdout; then > fork into the background, closing the stdout (and stderr, stdin) pipe. > > I have found this answer (forking -> setsid -> forking) > http://stackoverflow.com/a/3356154 > > However the stand

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Terry Reedy
On 12/23/2012 4:32 AM, prilisa...@googlemail.com wrote: By the way, I think I have found the correct "wording". for my understood, the "handover" of objects to imported modules doesn't work because, e.g. trying to hand-over an SQLite connection into a imported module, can't work because the "attr

Re: Parsing files in python

2012-12-23 Thread Terry Reedy
On 12/23/2012 12:19 PM, Kene Meniru wrote: Hello: I am writing a program that is made up of a collection of POV-Ray macros. POV-Ray is available at povray.org. It is a ray-tracing program that reads a scene description language (SDL) to create photo-realistic images. At this time my program (for

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread Hans Mulder
On 24/12/12 01:34:47, iMath wrote: > how to detect the character encoding in a web page ? That depends on the site: different sites indicate their encoding differently. > such as this page: http://python.org/ If you download that page and look at the HTML code, you'll find a line: So it's

Re: urllib.error.HTTPError: HTTP Error 403: Forbidden

2012-12-23 Thread Steven D'Aprano
On Sun, 23 Dec 2012 17:05:47 -0800, iMath wrote: import urllib.request response = urllib.request.urlopen('http://en.wikipedia.org/wiki/ Internet_media_type') > Traceback (most recent call last): > File "", line 1, in > response = > urllib.request.urlopen('http://en.wikipe

Re: how to detect the character encoding in a web page ?

2012-12-23 Thread Chris Angelico
On Mon, Dec 24, 2012 at 11:34 AM, iMath wrote: > how to detect the character encoding in a web page ? > such as this page > > http://python.org/ You read part-way into the page, where you find this: That tells you that the character set is UTF-8. ChrisA -- http://mail.python.org/mailman/lis

urllib.error.HTTPError: HTTP Error 403: Forbidden

2012-12-23 Thread iMath
>>> import urllib.request >>> response = >>> urllib.request.urlopen('http://en.wikipedia.org/wiki/Internet_media_type') Traceback (most recent call last): File "", line 1, in response = urllib.request.urlopen('http://en.wikipedia.org/wiki/Internet_media_type') File "C:\Python32\lib\urlli

Forking into the background (Linux)

2012-12-23 Thread Olive
My goal is to write a script that 1) write something to stdout; then fork into the background, closing the stdout (and stderr, stdin) pipe. I have found this answer (forking -> setsid -> forking) http://stackoverflow.com/a/3356154 However the standard output of the child is still connected to

how to detect the character encoding in a web page ?

2012-12-23 Thread iMath
how to detect the character encoding in a web page ? such as this page http://python.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing files in python

2012-12-23 Thread Chris Angelico
On Mon, Dec 24, 2012 at 4:19 AM, Kene Meniru wrote: > Hello: I am writing a program that is made up of a collection of POV-Ray > macros. POV-Ray is available at povray.org. It is a ray-tracing program that > reads a scene description language (SDL) to create photo-realistic images. At > this ti

Re: Python, email temperature

2012-12-23 Thread Terry Reedy
On 12/23/2012 12:23 PM, Mitya Sirenef wrote: On 12/23/2012 08:46 AM, KarlE wrote: On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: from __future__ import division Depending on the linux installed, you should be able to run 3.2 or 3.3 instead of 2.7. Though there are still 2.x

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Rhodri James
On Sun, 23 Dec 2012 21:42:14 -, wrote: Okay, I try to publish this sample, and yes it's not a working piece of code, but I try to "draw" my problem that way. So instead of telling us what your problem is, you're going to give us an artist's impression of your code and leave us to guess

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread prilisauer
Okay, I try to publish this sample, and yes it's not a working piece of code, but I try to "draw" my problem that way. As you will see, I load modules, create cursor,... in the main.py. In the lower section you see, that the modules should execute sqls. In case It could occur that two queries oc

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Roy Smith
In article , prilisa...@googlemail.com wrote: > Thanks to all your answers, I have read a lot about namespaces, but still > there's something I do not understood. I have tried your example but as I > expected: > > line 13, in HandoverSQLCursor > curs.execute("SELECT * FROM lager") > Attrib

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Peter Otten
prilisa...@googlemail.com wrote: > Thanks to all your answers, I have read a lot about namespaces, but still > there's something I do not understood. I have tried your example but as I > expected: > > line 13, in HandoverSQLCursor > curs.execute("SELECT * FROM lager") > AttributeError: 'built

Re: Python USB control on Windows 7?

2012-12-23 Thread Michael Torrie
On 12/23/2012 11:11 AM, Duncan Booth wrote: > So far as I can tell Windows doesn't let you turn the ports on and off. I > found some suggestion that by connecting it to a powered hub it may be > possible to toggle the hub power on and off but that many hubs don't bother > implementing the functi

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread prilisauer
Thanks to all your answers, I have read a lot about namespaces, but still there's something I do not understood. I have tried your example but as I expected: line 13, in HandoverSQLCursor curs.execute("SELECT * FROM lager") AttributeError: 'builtin_function_or_method' object has no attribute

Re: Python, email temperature

2012-12-23 Thread Dave Angel
On 12/23/2012 08:46 AM, KarlE wrote: > On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: >> Hi! >> >> >> >> Im totally new to Python, and im using it on my Raspberry pi. I found a >> program that sends an email, and one that checks the temperature of my CPU, >> but i cant seem to comb

Re: Python USB control on Windows 7?

2012-12-23 Thread Duncan Booth
Chris Angelico wrote: > On Sun, Dec 23, 2012 at 6:28 PM, Tim Roberts wrote: >> Duncan Booth wrote: >>> >>>In this year's Christmas Raffle at work I won a 'party-in-a-box' >>>including USB fairy lights. >>> >>>They sit boringly on all the time, so does anyone know if I can >>>toggle the power ea

Re: Python, email temperature

2012-12-23 Thread Mitya Sirenef
On 12/23/2012 08:46 AM, KarlE wrote: On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: Hi! Im totally new to Python, and im using it on my Raspberry pi. I found a program that sends an email, and one that checks the temperature of my CPU, but i cant seem to combine the to into t

Parsing files in python

2012-12-23 Thread Kene Meniru
Hello: I am writing a program that is made up of a collection of POV-Ray macros. POV-Ray is available at povray.org. It is a ray-tracing program that reads a scene description language (SDL) to create photo-realistic images. At this time my program (for modeling building information) is so huge

Re: Python USB control on Windows 7?

2012-12-23 Thread inq1ltd
On Sunday, December 23, 2012 06:34:41 PM Chris Angelico wrote: > On Sun, Dec 23, 2012 at 6:28 PM, Tim Roberts wrote: > > Duncan Booth wrote: > >>In this year's Christmas Raffle at work I won a 'party-in-a-box' > >>including USB fairy lights. > >> > >>They sit boringly on all the time, so does any

Re: Python, email temperature

2012-12-23 Thread KarlE
On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: > Hi! > > > > Im totally new to Python, and im using it on my Raspberry pi. I found a > program that sends an email, and one that checks the temperature of my CPU, > but i cant seem to combine the to into the funktion that i want, s

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Cameron Simpson
On 22Dec2012 12:43, prilisa...@googlemail.com wrote: | I Think I describe my Situation wrong, the written Project is a | Server, that should store sensor data, perfoms makros on lamps according | a sequence stored in the DB and Rule systems schould regulate home devices and plan scheduler jobs so

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread prilisauer
secondly, it is absolutely not bad meaned, but, why does people post, their personal meaning, but nothing about the "Posters" Problem? Everybody is free to read or not, but correcting the WWW could became a very very big task, (maybe it's easier to climb the 7 summits) Best Regards. -- http://

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread prilisauer
By the way, I think I have found the correct "wording". for my understood, the "handover" of objects to imported modules doesn't work because, e.g. trying to hand-over an SQLite connection into a imported module, can't work because the "attributes" are not transfered. I'm sorry for my bad engli