Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 21:20:01 -0700, Ferrous Cranus wrote: > [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] > File "/home/nikos/public_html/cgi-bin/metrites.py", line 206, in > > [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] > cur.execute('''SELECT hits FROM counters

Re: Lettuce vs Behave

2013-08-28 Thread Ben Finney
cutems93 writes: > However, it seems these two [Lettuce and Behave] are very similar in > the way they function. As professionals, what do you prefer and why? I haven't used both, and have only begun using Behave. The Behave documentation compares it with Lettuce here http://pythonhosted.org/be

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Nick the Gr33k
Στις 29/8/2013 7:29 πμ, ο/η Ferrous Cranus έγραψε: Τη Πέμπτη, 29 Αυγούστου 2013 3:59:49 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: To be explicit: chgrp nobody the-file chmod g+w the-file Hello Cameron, ni...@superhost.gr [~/www]# touch err.out ni...@superhost.gr [~/www]# ls -l

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Πέμπτη, 29 Αυγούστου 2013 3:59:49 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: > To be explicit: > > > > chgrp nobody the-file > > chmod g+w the-file Hello Cameron, ni...@superhost.gr [~/www]# touch err.out ni...@superhost.gr [~/www]# ls -l err.out -rw-rw-r-- 1 nikos nikos 0

Re: semicolon at end of python's statements

2013-08-28 Thread Steven D'Aprano
On Thu, 29 Aug 2013 04:48:26 +0430, Mohsen Pahlevanzadeh wrote: > Dear all, > > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. > > Quesion: > What's really defferences between putting semicolon and don't put? It's about the same as writing this: x = 1

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Πέμπτη, 29 Αυγούστου 2013 1:56:55 π.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Wed, 28 Aug 2013 06:11:13 -0700, Ferrous Cranus wrote: > > > > > This si what iam tryign now since the function ishish proposed wont help > > > me. > > > > I see that your apology for careless writing di

Re: Interface and duck typing woes

2013-08-28 Thread Steven D'Aprano
On Thu, 29 Aug 2013 11:39:25 +1000, Chris Angelico wrote: > The novice thinks his primary job is to stop the program from crashing. > The expert knows that a crash is just another way for things to go > wrong, and one of the easiest to deal with. "I find it amusing when novice programmers believe

Re: Interface and duck typing woes

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 11:20 AM, Cameron Simpson wrote: > However, when working in Java its type strictness caught a great > many simple brainfart logic errors by checking function signatures; > typically calling the wrong function/method or mangling arguments. > Getting this stuff up front was h

Re: Interface and duck typing woes

2013-08-28 Thread Roy Smith
In article , Cameron Simpson wrote: > Anyway, I digress. My point is that there are plusses to having > signature/type checking at coding time. It is not the Python Way, > but I surely cannot be alone in sometimes being frustrated chasing > a deeply nested runtime error that static type checking

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Cameron Simpson
On 28Aug2013 12:11, Steven D'Aprano wrote: | On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: | > Also many times when i try to view the error_log by | > tail -F /usr/local/apache/logs/error_log & | > | > i get realtime scrolling of other joomla webistes pho errors and i have | > hard t

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Cameron Simpson
On 28Aug2013 18:44, Prasad, Ramit wrote: | Ferrous Cranus wrote: | > Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user | > Nobody. | > So, that mean that? user 'nobody' has no write permission to /home/nikos folder? As Ramit says, yes. Your own

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Cameron Simpson
On 28Aug2013 05:48, Nikos wrote: | Hi steven , sorry for the typos. | you are write my script is invoked by apache web server application which it runs under account 'nobody' [...] | nobody8449 0.0 0.2 65712 3228 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL [...]

Re: Interface and duck typing woes

2013-08-28 Thread Cameron Simpson
On 29Aug2013 09:17, Chris Angelico wrote: | On Thu, Aug 29, 2013 at 7:54 AM, Terry Reedy wrote: | > Depending on who the users will be, I might just not worry about it until an | > exception is raised. If you try to protect against everything that you might | > do wrong, you are on the road to ma

Re: semicolon at end of python's statements

2013-08-28 Thread Roy Smith
In article , Chris Angelico wrote: > This is about Perl, but may be of interest. > > http://www.perl.com/pub/2007/12/06/soto-11.html I got about halfway through, then raised an uncaught TLDNR Exception. But I did like what he had to say about Tcl. Tcl is under-appreciated. A few gigs back,

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:33 AM, Roy Smith wrote: > In article , > Mohsen Pahlevanzadeh wrote: > >> Dear all, >> >> I'm C++ programmer and unfortunately put semicolon at end of my >> statements in python. >> >> Quesion: >> What's really defferences between putting semicolon and don't put? > > I

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:37 AM, Tim Chase wrote: > On 2013-08-29 10:31, Chris Angelico wrote: >> but putting semicolons at the ends of Python statements is as >> useless as putting lots of (((irritating (((superfluous >> (((parentheses) in your C++ code. The parser won't mind, >>

Re: semicolon at end of python's statements

2013-08-28 Thread Ned Batchelder
On 8/28/13 8:18 PM, Mohsen Pahlevanzadeh wrote: Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defferences between putting semicolon and don't put? There is no difference. The semicolon is unnecessary in Python. If you i

Re: semicolon at end of python's statements

2013-08-28 Thread Roy Smith
In article , Mohsen Pahlevanzadeh wrote: > Dear all, > > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. > > Quesion: > What's really defferences between putting semicolon and don't put? In theory, nothing. In practice, all the real Python programmers

Re: semicolon at end of python's statements

2013-08-28 Thread Tim Chase
On 2013-08-29 10:31, Chris Angelico wrote: > but putting semicolons at the ends of Python statements is as > useless as putting lots of (((irritating (((superfluous > (((parentheses) in your C++ code. The parser won't mind, > but subsequent programmers will wonder what these unneces

Re: semicolon at end of python's statements

2013-08-28 Thread Tim Chase
On 2013-08-29 04:48, Mohsen Pahlevanzadeh wrote: > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. > > Quesion: > What's really defferences between putting semicolon and don't put? >From a technical standpoint, nothing (see below). From a "readability on t

Re: semicolon at end of python's statements

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 10:18 AM, Mohsen Pahlevanzadeh wrote: > Dear all, > > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. > > Quesion: > What's really defferences between putting semicolon and don't put? Very little. Putting the semicolon makes you look

semicolon at end of python's statements

2013-08-28 Thread Mohsen Pahlevanzadeh
Dear all, I'm C++ programmer and unfortunately put semicolon at end of my statements in python. Quesion: What's really defferences between putting semicolon and don't put? Yours, Mohsen -- http://mail.python.org/mailman/listinfo/python-list

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 18:56:56 -0400, Joel Goldstick wrote: > At any rate, isn't > this stuff really something that the Web Server company should be > helping him with? Its their server, they know how it is configured, and > they can quickly look in his directories to figure out permissions > relat

Re: Interface and duck typing woes

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 18:09:22 -0300, Joe Junior wrote: > While designing a simple library, I found myself asking a philosophical > question: to check or not to check the parameter's interface? The only correct answer to that is, "Yes no maybe". :-) > I think that, considering it is Python, the

Re: Interface and duck typing woes

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 7:54 AM, Terry Reedy wrote: > Depending on who the users will be, I might just not worry about it until an > exception is raised. If you try to protect against everything that you might > do wrong, you are on the road to madness, as the protection code might also > be buggy

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 06:11:13 -0700, Ferrous Cranus wrote: > This si what iam tryign now since the function ishish proposed wont help > me. I see that your apology for careless writing didn't last very long. [...] > except: > print( repr(e) ) What is the value of "e" here, and where is it defi

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Joel Goldstick
On Wed, Aug 28, 2013 at 6:49 PM, Steven D'Aprano wrote: > On Wed, 28 Aug 2013 18:44:28 +, Prasad, Ramit wrote: > >> Normally I would have thought you would have a public_html or www >> directory in your home folder that would be readable/writable to the web >> server (and where you should writ

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 4:44 AM, Prasad, Ramit wrote: > Normally I would have thought you would have a public_html or www directory > in your > home folder that would be readable/writable to the web server (and where you > should > write). No, a normal setup would have that world-readable but n

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 18:44:28 +, Prasad, Ramit wrote: > Normally I would have thought you would have a public_html or www > directory in your home folder that would be readable/writable to the web > server (and where you should write). I expect that he does. But Nikos has tried writing to the

Re: Interface and duck typing woes

2013-08-28 Thread Terry Reedy
On 8/28/2013 5:09 PM, Joe Junior wrote: While designing a simple library, I found myself asking a philosophical question: to check or not to check the parameter's interface? I think that, considering it is Python, the usual answer would be "no", but here is the situation that got me thinking: c

Re: String splitting with exceptions

2013-08-28 Thread John Levine
>Can you have brackets within brackets? If so, this is impossible to deal >with within a regex. Nope. It's a regular language, not a CFL. >Otherwise: re.findall('((?:[^[:]|\[[^]]*\])*):?',s) >['foo.[DOM]', '', '[IP6::4361:6368:6574]', '600', '', ''] That seems to do it, thanks. -- Regard

Re: Moving to Python for web

2013-08-28 Thread Andreas Ecaz
On Wednesday, August 28, 2013 11:25:44 PM UTC+2, Andreas Ecaz wrote: > I've looked at Flask, Bottle and Web.py. I quite like the look of Bottle. > I'll keep looking for some other microframeworks, maybe I can find something > else that interests me. > > > > Thank you. At the moment I'm worrie

Re: Moving to Python for web

2013-08-28 Thread Andreas Ecaz
On Wednesday, August 28, 2013 11:08:52 PM UTC+2, Joel Goldstick wrote: > On Wed, Aug 28, 2013 at 4:14 PM, wrote: > > > So, I have been working in PHP for several years but I want to learn > > something new. That something new is Python. But since I'm a web developer > > I want to build stuff f

Interface and duck typing woes

2013-08-28 Thread Joe Junior
While designing a simple library, I found myself asking a philosophical question: to check or not to check the parameter's interface? I think that, considering it is Python, the usual answer would be "no", but here is the situation that got me thinking: class Flock: def __init__(self):

Re: Moving to Python for web

2013-08-28 Thread Joel Goldstick
On Wed, Aug 28, 2013 at 4:14 PM, wrote: > So, I have been working in PHP for several years but I want to learn > something new. That something new is Python. But since I'm a web developer I > want to build stuff for the web. > > I don't want to use Django because it's too bloated, it seem to do

Re: My attempts in playing with tail-recursion in python

2013-08-28 Thread Thomas Baruchel
Le 28-08-2013, Thomas Baruchel a écrit : > The following functions are fully usable; I hope someone will enjoy using > them. > > If you are not interested by the explanations, just jump to the end of the > message and take my functions for using them. Despite the very short size of my function, I

Moving to Python for web

2013-08-28 Thread ecazs . net
So, I have been working in PHP for several years but I want to learn something new. That something new is Python. But since I'm a web developer I want to build stuff for the web. I don't want to use Django because it's too bloated, it seem to do everything for you. I don't like that. I want to

Re: python3 integer division debugging

2013-08-28 Thread Terry Reedy
On 8/28/2013 11:15 AM, Neal Becker wrote: The change in integer division seems to be the most insidious source of silent errors in porting code from python2 - since it changes the behaviour or valid code silently. In Python since 2.??, put 'from __future__ import integer_division' (sp?) at the

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Josh English
Reduce tricks are nice, but I prefer clarity sometimes: def double(x): return x*2 def add3(x): return x+3 def compose(*funcs): for func in funcs: if not callable(func): raise ValueError('Must pass callable functions') def inner(value): for func in fu

RE: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Prasad, Ramit
Ferrous Cranus wrote: > Yes Uli, the script metrits.py is being invoked by Apache Web Server which in > turn runs under user > Nobody. > So, that mean that? user 'nobody' has no write permission to /home/nikos > folder? Yes. You should make it group writable with "nobody" as the group. Use chmod

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Dave Angel
On 28/8/2013 07:38, Ferrous Cranus wrote: > > no this is the general error log apache produces for all the server. > > Is there a way to grep error logging info, pertainign only to my specific > nikos account or my superhost.gr domain? I now nothing about Apache logs, but how about grepping the

Re: String splitting with exceptions

2013-08-28 Thread Peter Otten
Neil Cerutti wrote: > On 2013-08-28, John Levine wrote: >> I have a crufty old DNS provisioning system that I'm rewriting and I >> hope improving in python. (It's based on tinydns if you know what >> that is.) >> >> The record formats are, in the worst case, like this: >> >> foo.[DOM]::[IP6::436

Re: String splitting with exceptions

2013-08-28 Thread Neil Cerutti
On 2013-08-28, Tim Chase wrote: > On 2013-08-28 13:14, random...@fastmail.us wrote: >> On Wed, Aug 28, 2013, at 12:44, John Levine wrote: >> > I have a crufty old DNS provisioning system that I'm rewriting >> > and I hope improving in python. (It's based on tinydns if you >> > know what that is.)

Re: String splitting with exceptions

2013-08-28 Thread Neil Cerutti
On 2013-08-28, John Levine wrote: > I have a crufty old DNS provisioning system that I'm rewriting and I > hope improving in python. (It's based on tinydns if you know what > that is.) > > The record formats are, in the worst case, like this: > > foo.[DOM]::[IP6::4361:6368:6574]:600:: > > What I

Re: can't get utf8 / unicode strings from embedded python

2013-08-28 Thread David M. Cotter
Thank you for your thoughtful and thorough response. I now understand much better what you (and apparently the others) were warning me against and I will certainly consider that moving forward. I very much appreciate your help as I learn about python and embedding and all these crazy encoding

Re: String splitting with exceptions

2013-08-28 Thread Tim Chase
On 2013-08-28 13:14, random...@fastmail.us wrote: > On Wed, Aug 28, 2013, at 12:44, John Levine wrote: > > I have a crufty old DNS provisioning system that I'm rewriting > > and I hope improving in python. (It's based on tinydns if you > > know what that is.) > > > > The record formats are, in th

Re: String splitting with exceptions

2013-08-28 Thread random832
On Wed, Aug 28, 2013, at 12:44, John Levine wrote: > I have a crufty old DNS provisioning system that I'm rewriting and I > hope improving in python. (It's based on tinydns if you know what > that is.) > > The record formats are, in the worst case, like this: > > foo.[DOM]::[IP6::4361:6368:6574]

Re: String splitting with exceptions

2013-08-28 Thread Skip Montanaro
> The record formats are, in the worst case, like this: > > foo.[DOM]::[IP6::4361:6368:6574]:600:: > Any suggestions? Write a little parser that can handle the record format? Skip -- http://mail.python.org/mailman/listinfo/python-list

String splitting with exceptions

2013-08-28 Thread John Levine
I have a crufty old DNS provisioning system that I'm rewriting and I hope improving in python. (It's based on tinydns if you know what that is.) The record formats are, in the worst case, like this: foo.[DOM]::[IP6::4361:6368:6574]:600:: What I would like to do is to split this string into a li

Re: python3 integer division debugging

2013-08-28 Thread Neal Becker
Chris Angelico wrote: > On Thu, Aug 29, 2013 at 1:21 AM, Oscar Benjamin > wrote: >> On 28 August 2013 16:15, Neal Becker wrote: >>> The change in integer division seems to be the most insidious source of >>> silent errors in porting code from python2 - since it changes the behaviour >>> or valid

Re: python3 integer division debugging

2013-08-28 Thread Chris Angelico
On Thu, Aug 29, 2013 at 1:21 AM, Oscar Benjamin wrote: > On 28 August 2013 16:15, Neal Becker wrote: >> The change in integer division seems to be the most insidious source of >> silent >> errors in porting code from python2 - since it changes the behaviour or valid >> code silently. >> >> I wis

Re: python3 integer division debugging

2013-08-28 Thread random832
On Wed, Aug 28, 2013, at 11:15, Neal Becker wrote: > The change in integer division seems to be the most insidious source of > silent > errors in porting code from python2 - since it changes the behaviour or > valid > code silently. > > I wish the interpreter had an instrumented mode to detect a

Re: python3 integer division debugging

2013-08-28 Thread Oscar Benjamin
On 28 August 2013 16:15, Neal Becker wrote: > The change in integer division seems to be the most insidious source of silent > errors in porting code from python2 - since it changes the behaviour or valid > code silently. > > I wish the interpreter had an instrumented mode to detect and report suc

python3 integer division debugging

2013-08-28 Thread Neal Becker
The change in integer division seems to be the most insidious source of silent errors in porting code from python2 - since it changes the behaviour or valid code silently. I wish the interpreter had an instrumented mode to detect and report such problems. -- http://mail.python.org/mailman/lis

Re: Improving the web page download code.

2013-08-28 Thread MRAB
On 28/08/2013 07:23, mukesh tiwari wrote: [snip] Initially I blocked the main using raw_input('') and it was working fine. u = Downloader() signal.signal( signal.SIGINT , u.handleexception) thread.start_new_thread ( u.createurl , () ) for i in xrange ( 5 ) : thread.start_new_thread

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 4:38:02 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: > Am 28.08.2013 13:55, schrieb Ferrous Cranus: > > > Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel > > έγραψε: > > >> You really have no directory in which you have write permissions? I

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ulrich Eckhardt
Am 28.08.2013 13:55, schrieb Ferrous Cranus: Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. of cours ei ahve write permissions. Here: ni...@superh

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread AdamKal
W dniu środa, 28 sierpnia 2013 15:43:39 UTC+2 użytkownik Tim Chase napisał: > When 3 replies from 3 people all arrive within minutes, each > suggesting reduce(), I'd figure it's the "one obvious way to do > it" :-) I guess it's at least a good hint ;) Thanks to all! :) -- http://mail.pytho

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Tim Chase
On 2013-08-28 06:23, AdamKal wrote: > Thanks! > > I guess this is as simple as it gets then. I was just looking for > the "one obvious way to do it". When 3 replies from 3 people all arrive within minutes, each suggesting reduce(), I'd figure it's the "one obvious way to do it" :-) -tkc --

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Chris Angelico
On Wed, Aug 28, 2013 at 11:23 PM, AdamKal wrote: > I guess this is as simple as it gets then. I was just looking for the "one > obvious way to do it". The one obvious way to do some things is to post on python-list and see what comes back :) I love reading over these sorts of threads, they're go

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Thomas Rachel
Am 2013-08-28 14:52 schrieb AdamKal: Hi, From time to time I have to apply a series of functions to a value in such a way: func4(func3(func2(func1(myval I was wondering if there is a function in standard library that would take a list of functions and a initial value and do the above li

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread AdamKal
Thanks! I guess this is as simple as it gets then. I was just looking for the "one obvious way to do it". W dniu środa, 28 sierpnia 2013 15:11:34 UTC+2 użytkownik Tim Chase napisał: > On 2013-08-28 05:52, AdamKal wrote: > > > From time to time I have to apply a series of functions to a value >

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Jussi Piitulainen
Tim Chase writes: > On 2013-08-28 05:52, AdamKal wrote: > > From time to time I have to apply a series of functions to a value > > in such a way: > > > > func4(func3(func2(func1(myval > > > > I was wondering if there is a function in standard library that > > would take a list of functions a

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread ishish
Am 28.08.2013 13:52, schrieb AdamKal: Hi, From time to time I have to apply a series of functions to a value in such a way: func4(func3(func2(func1(myval I was wondering if there is a function in standard library that would take a list of functions and a initial value and do the above like

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Jussi Piitulainen
AdamKal writes: > Hi, > > From time to time I have to apply a series of functions to a value > in such a way: > > func4(func3(func2(func1(myval > > I was wondering if there is a function in standard library that > would take a list of functions and a initial value and do the above > like t

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
This si what iam tryign now since the function ishish proposed wont help me. try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone()

Re: Is there a function that applies list of functions to a value?

2013-08-28 Thread Tim Chase
On 2013-08-28 05:52, AdamKal wrote: > From time to time I have to apply a series of functions to a value > in such a way: > > func4(func3(func2(func1(myval > > I was wondering if there is a function in standard library that > would take a list of functions and a initial value and do the above

My attempts in playing with tail-recursion in python

2013-08-28 Thread Thomas Baruchel
Hi, I would like to share some of my recent attempts concerning recursivity in python, more precisely recursivity with lambda functions. I know that the title of my thread with the "tail-recursion" words may wake up some long and old war; please don't take it as such. I am not claiming anything a

Is there a function that applies list of functions to a value?

2013-08-28 Thread AdamKal
Hi, >From time to time I have to apply a series of functions to a value in such a >way: func4(func3(func2(func1(myval I was wondering if there is a function in standard library that would take a list of functions and a initial value and do the above like this: func_im_looking_for([func1,

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 3:38:11 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Wed, 28 Aug 2013 05:17:34 -0700, Ferrous Cranus wrote: > > > > > As i have pointed out i as the owner of the accoutn have read and write > > > perimssion bot at www/ and www/cgi-bin i also chnage the filen

Re: split lines from stdin into a list of unicode strings

2013-08-28 Thread kurt . alfred . mueller
On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote: > On 28/8/2013 04:32, Kurt Mueller wrote: > > For some text manipulation tasks I need a template to split lines > > from stdin into a list of strings the way shlex.split() does it. > > The encoding of the input can vary. > Does that

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 05:17:34 -0700, Ferrous Cranus wrote: > As i have pointed out i as the owner of the accoutn have read and write > perimssion bot at www/ and www/cgi-bin i also chnage the filename and > still cant write to the file. If you type filenames as carelessly as you type requests for

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 3:21:25 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Wed, 28 Aug 2013 03:43:08 -0700, Ferrous Cranus wrote: > > > > > but i cannot see the error_log because of constant scrolling of error > > > output. > > > > Then don't use "tail -F", use "less". > > >

Re: New VPS Provider needed

2013-08-28 Thread Antoon Pardon
Op 28-08-13 13:25, Steven D'Aprano schreef: > On Wed, 28 Aug 2013 09:19:40 +0200, Antoon Pardon wrote: > >> Op 27-08-13 18:18, Steven D'Aprano schreef: >>> On Wed, 28 Aug 2013 00:41:17 +1000, Chris Angelico wrote: >>> On Wed, Aug 28, 2013 at 12:25 AM, Grant Edwards wrote: > On 2013-

Re: Why is str(None) == 'None' and not an empty string?

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 01:57:16 -0700, Piotr Dobrogost wrote: > Hi! > > Having repr(None) == 'None' is sure the right thing but why does > str(None) == 'None'? Wouldn't it be more correct if it was an empty > string? Why do you think an empty string is more correct? Would you expect str([]) or str

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 03:43:08 -0700, Ferrous Cranus wrote: > but i cannot see the error_log because of constant scrolling of error > output. Then don't use "tail -F", use "less". Or try "tail -s 60 -F" which will update only every 60 seconds. -- Steven -- http://mail.python.org/mailman/listi

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 3:11:07 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: > > > > > Τη Τρίτη, 27 Αυγούστου 2013 8:07:52 μ.μ. UTC+3, ο χρήστης Steven > > > D'Aprano έγραψε: > > > > >> Hint: you can use > > >> "print(type(

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread ishish
Well there you have it: File "/home/nikos/public_html/cgi-bin/metrites.py", line 191, in if not data: NameError: name 'data' is not defined -- http://mail.python.org/mailman/listinfo/python-list

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: > Τη Τρίτη, 27 Αυγούστου 2013 8:07:52 μ.μ. UTC+3, ο χρήστης Steven > D'Aprano έγραψε: >> Hint: you can use >> "print(type(page), file=open('path/to/some/file', 'w'))" >> >> to see the type of the variable 'page' without displaying it on y

Re: can't get utf8 / unicode strings from embedded python

2013-08-28 Thread Steven D'Aprano
On Tue, 27 Aug 2013 22:57:45 -0700, David M. Cotter wrote: > I am very sorry that I have offended you to such a degree you feel it > necessary to publicly eviscerate me. You know David, you are right. I did over-react. And I apologise for that. I am sorry, I was excessively confrontational. (Alt

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 2:51:03 μ.μ. UTC+3, ο χρήστης ishish έγραψε: > Am 28.08.2013 12:14, schrieb Ferrous Cranus: > > > Okey, continue trying and trying i came up with this: > > > > > > > > > try: > > > if os.path.exists( path + page ) or os.path.exists( cgi_path + page > > > ): > >

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: > On 28/8/2013 07:14, Ferrous Cranus wrote: > > > > > > > > > > > But i cannot test it without looking at the error log which is scrolling > > like hell and doesn't even quit with a ctrl+c > > > > I take it this

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread ishish
Am 28.08.2013 12:14, schrieb Ferrous Cranus: Okey, continue trying and trying i came up with this: try: if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() except:

Rép : Why is str(None) == 'None' and not an empty string?

2013-08-28 Thread Fabrice POMBET
On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: > Having repr(None) == 'None' is sure the right thing but why does str(None) == > 'None'? Wouldn't it be more correct if it was an empty string? the point of str(obj) is to return a string containing the obj (a sequence of characters if it is unboun

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: > On 28/8/2013 07:14, Ferrous Cranus wrote: > > > > > > > > > > > But i cannot test it without looking at the error log which is scrolling > > like hell and doesn't even quit with a ctrl+c > > > > I take it this

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: > On 28/8/2013 07:14, Ferrous Cranus wrote: > > > > > > > > > > > But i cannot test it without looking at the error log which is scrolling > > like hell and doesn't even quit with a ctrl+c > > > > I take it this

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Dave Angel
On 28/8/2013 07:14, Ferrous Cranus wrote: > > > But i cannot test it without looking at the error log which is scrolling like > hell and doesn't even quit with a ctrl+c I take it this 'error log" is shared with other users, and you can't constrain them to cease and desist for a while? > > How w

Re: New VPS Provider needed

2013-08-28 Thread Steven D'Aprano
On Wed, 28 Aug 2013 09:19:40 +0200, Antoon Pardon wrote: > Op 27-08-13 18:18, Steven D'Aprano schreef: >> On Wed, 28 Aug 2013 00:41:17 +1000, Chris Angelico wrote: >> >>> On Wed, Aug 28, 2013 at 12:25 AM, Grant Edwards >>> wrote: On 2013-08-27, wrote: > Iam having

Re: right adjusted strings containing umlauts

2013-08-28 Thread kurt . alfred . mueller
On Wednesday, August 28, 2013 12:23:12 PM UTC+2, Dave Angel wrote: > On 28/8/2013 04:01, Kurt Mueller wrote: > > Because I cannot switch to Python 3 for now my life is not so easy:-) > > For some text manipulation tasks I need a template to split lines > > from stdin into a list of strings the way

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Okey, continue trying and trying i came up with this: try: if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() except: with open("err.out", "a") as f:

Re: split lines from stdin into a list of unicode strings

2013-08-28 Thread Dave Angel
On 28/8/2013 04:32, Kurt Mueller wrote: > This is a follow up to the Subject > "right adjusted strings containing umlauts" You started a new thread, with a new subject line. So presumably we're starting over with a clean slate. > > For some text manipulation tasks I need a template to split lin

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε: > http://wiki.python.org/moin/HandlingExceptions is this how you mean? try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τετάρτη, 28 Αυγούστου 2013 1:43:08 μ.μ. UTC+3, ο χρήστης Ferrous Cranus έγραψε: > Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε: > > > > > http://wiki.python.org/moin/HandlingExceptions > > > > is this how you mean? > > > > try: > >

Re: right adjusted strings containing umlauts

2013-08-28 Thread Dave Angel
On 28/8/2013 04:01, Kurt Mueller wrote: > Because I cannot switch to Python 3 for now my life is not so easy:-) > > For some text manipulation tasks I need a template to split lines > from stdin into a list of strings the way shlex.split() does it. > The encoding of the input can vary. > For furt

Re: Why is str(None) == 'None' and not an empty string?

2013-08-28 Thread Terry Reedy
On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: Having repr(None) == 'None' is sure the right thing but why does str(None) == 'None'? Wouldn't it be more correct if it was an empty string? No. There is no reason to be different. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/pyt

about pyyaml questions!

2013-08-28 Thread Thanatos xiao
Hi Guys: Now I use pyyaml to load a yaml file, after I dump this load data,but I found an questions,before I load the yaml file,the file looks like: - -b -c - -e -x after I dump this data and write file, the file looks like: - -b -c - -e -x although when dump fil

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread ishish
Am 28.08.2013 10:48, schrieb Ferrous Cranus: >> I quote from a Python 3 Guide >> [http://python.about.com/od/python30/ss/30_strings_3.htm]: >> >> The two data types, str and bytes, are mutually exclusive. One >> cannot >> legally combine them into one call. With the distinction between >> t

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
Τη Τρίτη, 27 Αυγούστου 2013 6:22:32 μ.μ. UTC+3, ο χρήστης ishish έγραψε: > Am 27.08.2013 16:04, schrieb Ferrous Cranus: > > > Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε: > > >>> [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error > > >>> in > > >>> sys.excepthook: > > >>> [Tue Au

Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of

2013-08-28 Thread Ferrous Cranus
In my attemtpt to be shwon only mesages pertaining to superhost.gr i try: alias err='tail -F /usr/local/apache/logs/error_log | grep nikos &' but now it only displays to me the lines that have '/home/nikos' within them and not all the relevant error lines. -- http://mail.python.org/mailman/list

Re: Improving the web page download code.

2013-08-28 Thread Alister
On Tue, 27 Aug 2013 12:41:10 -0700, mukesh tiwari wrote: > Hello All, > I am doing web stuff first time in python so I am looking for > suggestions. I wrote this code to download the title of webpages using > as much less resource ( server time, data download) as possible and > should be fast eno

  1   2   >