Re: How to exec() a string like interactive python does?

2012-06-06 Thread News123
On 06/06/2012 01:31 AM, Steven D'Aprano wrote: On Wed, 06 Jun 2012 00:12:00 +0200, News123 wrote: If I start Python in interactive mode, and I yype the commands, 'a=3', 'a', 'print a' Then the output would look like: >>> a = 3 >>>

Re: How to exec() a string like interactive python does?

2012-06-06 Thread News123
On 06/06/2012 12:12 AM, News123 wrote: If I start Python in interactive mode, and I yype the commands, 'a=3', 'a', 'print a' Then the output would look like: >>> a = 3 >>> a 3 >>> print a 3 Now within an application I

How to exec() a string like interactive python does?

2012-06-05 Thread News123
If I start Python in interactive mode, and I yype the commands, 'a=3', 'a', 'print a' Then the output would look like: >>> a = 3 >>> a 3 >>> print a 3 Now within an application I'd like to achieve exactly this behaviour Meaning, that - for assignments nothing is displayed - for expressions t

Re: Using django ORM from web browser and from command line apps

2011-06-21 Thread News123
On 06/22/2011 03:08 AM, Ian Kelly wrote: > On Tue, Jun 21, 2011 at 6:21 PM, News123 wrote: >> Out of curiousity: Do you know whether the imports would be executed for >> each potential command as soon as I call manage.py or only >> 'on demand'? > > Off the

Re: using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread News123
On 06/22/2011 03:02 AM, Roy Smith wrote: > In article <4e012e8d$0$23682$426a3...@news.free.fr>, > News123 wrote: > > > I don't see any reason you couldn't use the Model layer by itself, if > you want to. It pretty much stands on its own. Thanks a lot fo

Re: using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread News123
On 06/22/2011 03:04 AM, Ian Kelly wrote: >> >> So I need at least a little more to make my script work. > > There's a bit of magic in the way Django finds things, and I think > you'll still need to keep the basic structure of a Django project -- > models should be in a "models.py" file located in

Re: using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread News123
It seems I found a solution (refer to end of this tessage). Not sure though if there are any drawbacks or if this method of working could cause any other issues. On 06/22/2011 02:42 AM, News123 wrote: > On 06/22/2011 01:51 AM, News123 wrote: >> Hi, >> >> I have a small app

Re: using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread News123
On 06/22/2011 01:51 AM, News123 wrote: > Hi, > > I have a small application running on a host without web server and > without any need for django except its ORM accessing data bases without > explicitely writing sql queries.) > > I assume there's many libraries (SQL

Re: Using django ORM from web browser and from command line apps

2011-06-21 Thread News123
Hi Ian, On 06/22/2011 02:09 AM, Ian Kelly wrote: > On Tue, Jun 21, 2011 at 5:39 PM, News123 wrote: >> I'm having a django browser application. >> >> There's certain administrative tasks, that I'd like to perform from the >> command line (cronjob or manu

using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread News123
Hi, I have a small application running on a host without web server and without any need for django except its ORM accessing data bases without explicitely writing sql queries.) I assume there's many libraries (SQL Alchemy or others), which could do this job. and which migh have less overhead tha

Using django ORM from web browser and from command line apps

2011-06-21 Thread News123
Hi, I'm having a django browser application. There's certain administrative tasks, that I'd like to perform from the command line (cronjob or manually). As these scripts might be huge and might consume quite some memory I'd prefer, that they were not part of the normal application and would just

Re: best book about Webdesign with Django

2011-06-10 Thread News123
Hi Thomas, APologies for not being clear enough in my question. On 06/09/2011 04:40 PM, Thomas Guettler wrote: > On 08.06.2011 12:29, News123 wrote: >> Hi, >> >> >> Do you have any recommendations for a good book about Web design with >> Django? > > Y

best book about Webdesign with Django

2011-06-08 Thread News123
Hi, Do you have any recommendations for a good book about Web design with Django? Thanks for suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: portable way of sending notifying a process

2011-05-30 Thread News123
Thanks for all your feedback. Well, I'll play a little and go either for a wrapper around ways to detecth a file change or for a tiny socket solution. Thanks again. On 05/30/2011 04:03 AM, Chris Angelico wrote: > On Mon, May 30, 2011 at 11:44 AM, Chris Torek wrote: >>> What would be a light w

portable way of sending notifying a process

2011-05-28 Thread News123
Hi, I'm looking for a portable way (windows XP / Windows Vista and Linux ) to send a signal from any python script to another one (one signa would be enough) I have several python scripts started from different parent processes occasionally some of the scripts want to tell another to reread it'

Re: Free Software University - Python Certificate - In reply to Noah Hall

2011-03-29 Thread News123
Hi Loyd, It wasn't me sending you the private email. I'm just a little surprised about this: "if you don't post under your real name you must be a bad person" - attitude. On 03/27/2011 01:15 PM, Lloyd Hardy wrote: > Secondly, if you do use various names and email addresses and play > 'maybe thi

Re: Free Software University - Python Certificate - In reply to Noah Hall

2011-03-29 Thread News123
Hi Loyd, Having a decent front page might help to attract people: Go to http://www.freesoftwareuni.com/ and try to get any useful information except (free / GPL / not accredited / your email address) With out signing in / without registering you don't even see what FSU has to offer / plans

Re: Free Software University - Python Certificate

2011-03-22 Thread News123
Hi Juan, On 03/22/2011 04:54 AM, Giovani wrote: > Hi all, my name is Juan and I suscribed to this website called "Free > Software University", opened recently. One of the goals of this > website is making some free high quality courses, one of them about > Python. > > I want to say this message

Re: run a function in another processor in python

2010-12-13 Thread News123
On 12/09/2010 10:54 AM, Astan Chee wrote: > Hi, > I've got a python script that calls a function many times with various > arguments and returns a result. What I'm trying to do is run this > function each on different processors and compile the result at the > end based on the function result. The

Re: remote control firefox with python

2010-11-28 Thread News123
On 11/28/2010 06:19 PM, Tim Harig wrote: > On 2010-11-28, News123 wrote: >> Thanks in advance for any pointers ideas. > > google XPCOM thanks a lot -- http://mail.python.org/mailman/listinfo/python-list

remote control firefox with python

2010-11-28 Thread News123
Hi, I wondered whether there is a simpe way to 'remote' control fire fox with python. With remote controlling I mean: - enter a url in the title bar and click on it - create a new tab - enter another url click on it - save the html document of this page - Probably the most difficult one: emulat

Re: google group api with python

2010-11-28 Thread News123
On 11/27/2010 11:51 PM, macroasm wrote: > hi. i want google group with send python. how do user api. Hi macroasm, You will probably increase tha amount of replies if you elaborate on your question. I personally do not really understand what you exactly asked for. -- http://mail.python.org

Re: Newbie subprocess question

2010-11-26 Thread News123
On 11/26/2010 12:18 AM, Tim Harig wrote: > On 2010-11-25, Hugo Léveillé wrote: >> I'm starting various application using subprocess.Popen without any >> problem. The problem is with application inside "Program Files". It >> looks like subprocess is stopping the application string after >> "Program

Re: QT window closes immediately

2010-11-16 Thread News123
On 11/15/2010 02:04 AM, Martin Caum wrote: > I am attempting to open a window on mouse activity which works, but > the window fails to stay open. > I set it to terminate when the escape key is pressed even when the > program is not currently selected. This works fine. Originally I had > it create t

Re: how to identify currently running threads QTHreads

2010-11-14 Thread News123
On 11/14/2010 05:32 PM, Aahz wrote: > In article <4cdfe050$0$10182$426a3...@news.free.fr>, > News123 wrote: >> > >> >Is there a simple way in Python to identify all active Threads / >> >QThreads when trying, such that I can locate the thread,

how to identify currently running threads QTHreads

2010-11-14 Thread News123
Hi I'm working with several persons on a PyQT python application. This application is using threads / QThreads in several places. When trying to quit the application it doesn't stop. I assume one thread / QThread did not stop. (wasn't declared as daemon thread) Is there a simple way in Pyth

Re: Python documentation too difficult for beginners

2010-11-04 Thread News123
On 11/02/2010 02:42 PM, Steven D'Aprano wrote: > However, there is a Python wiki. It doesn't get anywhere near as much > love as it deserves, and (I think) the consensus was that the official > Python docs should stay official, but link to the wiki for user- > contributed content. This hasn't ha

Re: import ImageGrab fails on Ubuntu 10.4

2010-10-31 Thread News123
On 10/31/2010 05:04 PM, News123 wrote: > importing ImageGrab un Ubuntu 10.4 fails as seen below: > > import _grabscreen > ImportError: No module named _grabscreen > Well I found a partial answer on http://www.pythonware.com/library/pil/handbook/imagegrab.htm > The Image

import ImageGrab fails on Ubuntu 10.4

2010-10-31 Thread News123
Hi, It's the first time I wanted to use ImageGrab. importing ImageGrab fails as seen below: $ python -c "import ImageGrab" Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/dist-packages/PIL/ImageGrab.py", line 34, in import _grabscreen ImportError: No mo

Re: no .pyc

2010-10-07 Thread News123
On 10/07/2010 11:55 AM, Tim Hanson wrote: > I feel a little silly. I am learning Python by reading _Learning_Python_ by > Mark Lutz. I made it all the way to "Hello World" before my first question. > :-) > > The program isn't too complicated. > print "Hello World" > print 2**100 > > I saved i

Re: play sound on Ubuntu 10.4. (pulse audio?)

2010-09-12 Thread News123
Hi Tim, On 09/11/2010 11:42 PM, Tim Harig wrote: > On 2010-09-11, News123 wrote: >> What would be the way to detect how to play audio on a linux system >> without knowing ufront whether the system uses pulse, ALSA or whatever? > > I would suggest libao: > http:

play sound on Ubuntu 10.4. (pulse audio?)

2010-09-11 Thread News123
Hi, >From a python script I'd like to play sound on Ubuntu 10.4 I made two attempts: the first one is drectly writing to '/dev/audio', which works, but only if no other application plays audio (like for example amarok) The second attempt was playing audio via ALSA. The application doesn't fail

Re: are there pros or contras, keeping a connection to a (sqlite) database ?

2010-09-09 Thread News123
On 09/09/2010 12:29 AM, CM wrote: > On Sep 8, 1:09 pm, Stef Mientki wrote: >> hello, >> >> I wrap my database in some class, and on creation of the instance, a >> connection to the database is >> created, >> and will stay connected until the program exists, something like this: >> >> self.co

Re: how to find out, whether a path is socket or device

2010-08-30 Thread News123
On 08/30/2010 02:09 AM, Steven D'Aprano wrote: > On Mon, 30 Aug 2010 01:46:16 +0200, News123 wrote: > >> Hi, >> >> Under Linux I'd like to find out, whether I got a file, a character >> device or a socket as a parameter. > > See the stat module.

how to find out, whether a path is socket or device

2010-08-29 Thread News123
Hi, Under Linux I'd like to find out, whether I got a file, a character device or a socket as a parameter. What is the right way to do this How can I found out, whether a path name is: - a file ( os.isfile() ) - a character device - a socket - a named pipe thanks a lot for pointers -- http

Re: Fibonacci: returning a selection of the series

2010-08-29 Thread News123
On 08/29/2010 07:36 PM, Baba wrote: > level: beginner > > i would like to return a selection of the Fibonacci series. > example: > start = 5 ; end = 55 > the function should then return [5, 8, 13, 21, 34, 55] > > it seems that this is best resolved using an iterative approach to > generate the s

Re: Fibonacci: How to think recursively

2010-08-29 Thread News123
Hi Baba, > So here's my code. It does still cause me one headache. If i use > f(0)=0 > and f(1)=1 as base cases the result will be 144. I was expecting the > result to be the next value in the series (233)... > If i use f(1)=1 and f(2)=2 as base cases them i get my expected > result. I assume this

Re: Fibonacci: How to think recursively

2010-08-29 Thread News123
On 08/29/2010 01:12 AM, Baba wrote: > Level: beginner > > I would like to know how to approach the following Fibonacci problem: > How may rabbits do i have after n months? > > I'm not looking for the code as i could Google that very easily. I'm > looking for a hint to put me on the right track to

Re: equivalent of source in python?

2010-08-24 Thread News123
On 08/24/2010 09:18 PM, Astan Chee wrote: > Hi, > I'm trying to convert my tcsh script to python and am stuck at one part, > particularly the part of the script that looks like this: > > #!/bin/tcsh > setenv LSFLOG /var/tmp/lsf_log > source /etc/setup > unalias cp > umask 0 > env >> ${AFLOG} > >

Re: Iterative vs. Recursive coding

2010-08-20 Thread News123
On 08/20/2010 02:26 AM, Steven D'Aprano wrote: > On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: > >> Recursion can be quite a trick to get your mind round at first > > Really? Do people actually find the *concept* of recursion to be tricky? Is this a sincere surprise or are you just b

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-18 Thread News123
On 08/17/2010 11:44 PM, Baba wrote: > On Aug 16, 6:28 pm, "cbr...@cbrownsystems.com" > wrote: > >> First, suppose d = gcd(x, y, z); then for some x', y', z' we have that >> x = d*x', y = d*y', z = d*z'; and so for any a, b, c: >> > > >could you explain the notation? > >what is the diff

Re: Opposite of split

2010-08-17 Thread News123
On 08/17/2010 05:46 PM, Grant Edwards wrote: > On 2010-08-17, Neil Cerutti wrote: >> On 2010-08-17, Stefan Schwarzer wrote: >>> Hi Alex, >>> >>> On 2010-08-16 18:44, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. Help me

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread News123
Hi BAba, On 08/13/2010 09:25 PM, Ian Kelly wrote: > On Fri, Aug 13, 2010 at 12:25 PM, Baba wrote: >> Hi News 123, >> >> Ok i'm getting closer. I am able to write code that will output values >> that can be bought in exact quantity (truelist) and values that cannot >> be bought in exact quantitie

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-13 Thread News123
On 08/13/2010 10:57 AM, Martin P. Hellwig wrote: > SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION > > On 08/12/10 21:41, News123 wrote: > >> On 08/12/2010 09:56 PM, Martin P. Hellwig wrote: >>> On 08/11/10 21:14, Baba wrote: >>> >>> >&g

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread News123
Roald, What would your solution be if you weren't allowed to 'know' that 120 is an upper limit. Assume you were only allowed to 'know', that you won't find any other amount, which can't be bought A AOON A you found six solutions in a row? I have a rather straightforward solution trying from 0

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread News123
On 08/12/2010 10:51 PM, John Posner wrote: > On 8/12/2010 9:22 AM, Dave Angel wrote: >>> >>> Now you have to find the largest number below 120, which you can >>> easily do with brute force > > Dept of overkill, iterators/generators division ... > > -John > > #-- > from itertools

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-12 Thread News123
On 08/12/2010 09:56 PM, Martin P. Hellwig wrote: > On 08/11/10 21:14, Baba wrote: > > > How about rephrasing that question in your mind first, i.e.: > > For every number that is one higher then the previous one*: > If this number is dividable by: > 6 or 9 or 20 or any combination of

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread News123
One more small tip to verify whether your code is working: On 08/12/2010 10:28 PM, News123 wrote: > Hi Baba, Your code, but returning the result as suggested in my preious post: > def can_buy(n_nuggets): >for a in range (1,n_nuggets): >for b in range

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread News123
Hi Baba, The last tips should really help you getting started: for testing your function you could do: Below your uncorrected code and a test for it def can_buy(n_nuggets): for a in range (1,n_nuggets): for b in range (1,n_nuggets): for c in range (1,n_nuggets):

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-12 Thread News123
On 08/11/2010 10:14 PM, Baba wrote: > level: beginner > > exercise: given that packs of McNuggets can only be bought in 6, 9 or > 20 packs, write an exhaustive search to find the largest number of > McNuggets that cannot be bought in exact quantity. > > exercise source: > http://ocw.mit.edu/cours

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-12 Thread News123
Hi Steven, On 08/12/2010 01:37 AM, Steven D'Aprano wrote: > On Wed, 11 Aug 2010 13:14:35 -0700, Baba wrote: > >> level: beginner >> >> exercise: given that packs of McNuggets can only be bought in 6, 9 or 20 >> packs, write an exhaustive search to find the largest number of >> McNuggets that cann

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-11 Thread News123
As said in the instructions. if you find six consecutive numbers, that can be bough in exact quantity, then you know, that all bigger numbers can also be bought in exact quantity. I would do a brute force approach first I would create one function, which will try to find out, whether one can

Re: GUI automation tool (windows)

2010-08-10 Thread News123
On 08/10/2010 12:25 PM, Alex Barna wrote: > On Aug 10, 10:05 am, Lawrence D'Oliveiro > Can’t understand the point > to it. “GUI automation” is a contradiction in >> terms, because a GUI is designed for use by humans to do manual tasks, not >> ones that can be automated. > > Automating GUI is for t

Re: Python "why" questions

2010-08-07 Thread News123
On 08/07/2010 05:36 AM, Ryan Kelly wrote: > On Fri, 2010-08-06 at 22:05 -0500, Default User wrote: >> >From "the emperor's new clothes" department: >> >> 1) Why do Python lists start with element [0], instead of element >> [1]? "Common sense" would seem to suggest that lists should start >> with

Re: Python Script Cannot Write to Directory

2010-08-05 Thread News123
On 08/04/2010 09:27 AM, Chris Rebert wrote: > On Wed, Aug 4, 2010 at 12:21 AM, News123 wrote: > >> 3.) try following python >> >> import os >> print os.getcwd() >> import shutil >> shutil("YOUR_SOURCE_FILE_NAME","DESTINATION_DIRECTORY/D

Re: Python Script Cannot Write to Directory

2010-08-04 Thread News123
On 08/04/2010 06:01 AM, Chris Brauchli wrote: > Hi, > > I am writing a script that, at one point, copies a file from directory > A to directory B. Directory B can only be written to by root, but the > script is always called with sudo, so this shouldn't be an issue, but > it is. I have tried using

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-02 Thread News123
On 08/01/2010 07:53 PM, Jon Clements wrote: > On 1 Aug, 16:43, News123 wrote: >> On 08/01/2010 05:34 PM, Steven W. Orr wrote: >> >> >> >>> On 08/01/10 07:27, quoth News123: >>>> On 08/01/2010 01:08 PM, News123 wrote: >>>>> I w

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-01 Thread News123
On 08/01/2010 05:34 PM, Steven W. Orr wrote: > On 08/01/10 07:27, quoth News123: >> On 08/01/2010 01:08 PM, News123 wrote: >>> I wondered, whether there's a simple/standard way to let >>> the Optionparser just ignore unknown command line switches. >>> >

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-01 Thread News123
On 08/01/2010 01:08 PM, News123 wrote: > I wondered, whether there's a simple/standard way to let > the Optionparser just ignore unknown command line switches. > In order to illustrate, what I try to achieve: import optparse parser = optparse.OptionParser() parser.add_optio

let optionparse.Optionparser ignore unknown command line switches.

2010-08-01 Thread News123
I wondered, whether there's a simple/standard way to let the Optionparser just ignore unknown command line switches. thanks in advance for any ideas -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint scores

2010-08-01 Thread News123
ariable names like x,y as they are completely meaningful names for pixel coordinates. so change the entry good-names good-names=x,y,ex,Run,_ Hope, that this gave you some ideas > > On Sat, Jul 31, 2010 at 2:48 AM, Dan Stromberg wrote: >> >> On Fri, Jul 30, 2010 at 12:18 PM,

Re: pylint scores

2010-07-30 Thread News123
On 07/30/2010 03:12 PM, wheres pythonmonks wrote: > I am starting to use pylint to look at my code and I see that it gives a > rating. > What values do experienced python programmers get on code not > targeting the benchmark? > > I wrote some code, tried to keep it under 80 characters per line, >

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 10:18 PM, Thomas Jollans wrote: > On 07/25/2010 10:04 PM, News123 wrote: >> sOn 07/25/2010 09:39 PM, Christian Heimes wrote: >>> Am 25.07.2010 21:32, schrieb Thomas Jollans: >>>> If a script uses sys.executable instead of "python

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 09:33 PM, Edward Diener wrote: > On 7/25/2010 10:31 AM, News123 wrote: >> On 07/25/2010 02:46 PM, Edward Diener wrote: >>> On 7/25/2010 6:07 AM, Gelonida wrote: > > How does a 'pystarter' program know where the file's location is which &g

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
sOn 07/25/2010 09:39 PM, Christian Heimes wrote: > Am 25.07.2010 21:32, schrieb Thomas Jollans: >> If a script uses sys.executable instead of "python", there is no >> problem, at all. sys.executable will not work with scripts converted with py2exe, as sys.executable will not be the executable o

Re: Compare two nested dictionaries

2010-07-25 Thread News123
Hi, On 07/25/2010 06:21 PM, Steven D'Aprano wrote: > On Sun, 25 Jul 2010 08:03:06 -0700, targetsmart wrote: > >> Hi, >> I am trying to compare two nested dictionaries, I want to know what is >> the exact difference between them. I tried this solution >> >> ... >> s1 = set(result1) >>

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 02:46 PM, Edward Diener wrote: > On 7/25/2010 6:07 AM, Gelonida wrote: >> There the windows solution could be something like a small 'pystarter' >> program, which would decide depending on the file's location / the >> file's first line which python should be started. > > This does n

Re: Difference between import in script and from interpreter

2010-07-19 Thread News123
Edward Diener wrote: > In a python script a: > > from xxx.yyy.zzz import aaa > > fails with the message: > > "ImportError: No module named xxx.yyy.zzz" > > but from within the python interpreter the same line succeeds. What > would be the causes of that ? > > From within the python interpreter

Re: rstrip()

2010-07-19 Thread News123
Dennis Lee Bieber wrote: > On Sun, 18 Jul 2010 17:49:11 +0100, MRAB > declaimed the following in gmane.comp.python.general: > >> How about 'strip_str', 'lstrip_str' and 'rstrip_str', or something > > Not sure what the first would do... unless one is envisioning > > "abracadabra".str

Re: rstrip()

2010-07-18 Thread News123
MRAB wrote: > News123 wrote: >> Thomas Jollans wrote: >> >>> >>>> string.rstrip( [ '-dir' ] ) >>>> or as >>>> string.rstrip( '-dir' ) >>> The former should certainly raise an exception. '-dir' i

Re: rstrip()

2010-07-18 Thread News123
Thomas Jollans wrote: > > >> string.rstrip( [ '-dir' ] ) >> or as >> string.rstrip( '-dir' ) > > The former should certainly raise an exception. '-dir' is not a single > character ! > Or it should actually strip '-dir', or '-dir-dir', but not 'r--i'... but > that's just silly. > It's silly wi

Re: rstrip()

2010-07-18 Thread News123
Mark Lawrence wrote: > On 17/07/2010 23:17, MRAB wrote: >> Chris Rebert wrote: >>> On Fri, Jul 16, 2010 at 10:27 AM, MRAB >>> wrote: Jason Friedman wrote: >>> >>> It's a pity that str.strip() doesn't actually take a set() of length-1 >>> strings, which would make its behavior more obvious and

Re: rstrip()

2010-07-17 Thread News123
Jason Friedman wrote: > $ python > Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) > [GCC 4.4.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. "x.vsd-dir".rstrip("-dir") > 'x.vs' > > I expected 'x.vsd' as a return value. This is kind of similiar to the q

nicer way to remove prefix of a string if it exists

2010-07-13 Thread News123
I wondered about a potentially nicer way of removing a prefix of a string if it exists. Here what I tried so far: def rm1(prefix,txt): if txt.startswith(prefix): return txt[len(prefix):] return txt for f in [ 'file:///home/me/data.txt' , '/home/me/data.txt' ]: # method 1 i

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread News123
dhruvbird wrote: > > On a side note, is there any other way to append to a list using > slices (apart from the one below): > x[len(x):len(x)] = [item to append] dy you mean x.extend([1,2,3]) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy questions from a python beginner

2010-07-11 Thread News123
Chris Rebert wrote: > On Sun, Jul 11, 2010 at 2:08 PM, News123 wrote: >> Carl Banks wrote: >>> On Jul 11, 10:48 am, wheres pythonmonks >>> wrote: >>>> I'm an old Perl-hacker, and am trying to Dive in Python. >>> Welcome to the light. &

Re: Easy questions from a python beginner

2010-07-11 Thread News123
Carl Banks wrote: > On Jul 11, 10:48 am, wheres pythonmonks > wrote: >> I'm an old Perl-hacker, and am trying to Dive in Python. > > Welcome to the light. > > >> I have some >> easy issues (Python 2.6) >> which probably can be answered in two seconds: >> >> 1. Why is it that I cannot use prin

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread News123
Andreas Waldenburger wrote: > > Having capitalized boolean values ... that is a bit odd, but as long as > children are starving in Africa, this isn't very high on my gripe-list. > +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread News123
Andre Alexander Bell wrote: > On 07/11/2010 10:30 AM, rantingrick wrote: >>> So, it is not a disadvantage that the functions you listed above are >>> named in this way. In the contrary, it is an advantage, as it keeps >>> newcomers from using stupid variable names. >> "int" for an Integer is stupi

Re: MySqlDb any way to see the query string

2010-07-10 Thread News123
Hi everybody, im Roberts wrote: > News123 wrote: >> I'm using MYSQLdb >> >> and have following code >> >> db = MySQLdb.connect(**cfg) >> c = db.cursor() >> qrystr = "insert mytable set id = %s , other_field = %s" >> c.execute(q

MySqlDb any way to see the query string

2010-07-10 Thread News123
Hi, I'm using MYSQLdb and have following code db = MySQLdb.connect(**cfg) c = db.cursor() qrystr = "insert mytable set id = %s , other_field = %s" c.execute(qrystr, (id_val,other_field_val) ) What I wondered is whether there is any way to print the 'filled in' query string for debuggin. Th

Re: question about multiprocessing

2010-06-24 Thread News123
hywhy wrote: > thanks,friend! > I wanna use Queue to share objects,but on windows, the multiprocessing > module can‘t do this。 Is there any way to solve this problem! > thanks With multiprocessing.SyncManager you should be able to exchange Queues between different processes. -- http://mail.py

Re: setup server from scratch (with or without apache?)

2010-06-21 Thread News123
Hi Kruptein, Kruptein wrote: > I think that apache and mod_python are good enough, but I'm not an > expert. > > but I think that the security aspect for a large part depends on how > secure your code is. > > You can have a very secure server setting, but somewhere a bug in your > code that makes

Re: setup server from scratch (with or without apache?)

2010-06-21 Thread News123
News123 wrote: > Hi, > > > So far I never really had to ask this question and this is also, why I > am stil a little shaky on this topic: > > So far the typical LAMP server existed already and contained already a > lot of existing PHP web applications, which I couldn'

setup server from scratch (with or without apache?)

2010-06-20 Thread News123
Hi, So far I never really had to ask this question and this is also, why I am stil a little shaky on this topic: So far the typical LAMP server existed already and contained already a lot of existing PHP web applications, which I couldn't remove. Therefore I just used mod_python to implement som

Re: newbie subprocess.Popen performance issues/questions

2010-06-15 Thread News123
Chris Seberino wrote: > I tried to use subprocess.Popen to make my web app do a bunch of stuff > in separate processes today. It appeared like only the first one > finished and/or the rest of the forked processes crashed. > First thing to do would be to show us a little code and to look for the e

Re: How to read source code of python?

2010-06-10 Thread News123
Leon wrote: > Hi, there, > I'm trying to read the source code of python.dd > I read around, and am kind of lost, so where to start? > > Any comments are welcomed, thanks in advance. I use my favourite text editor with syntax highlighting. Next to it I use a web browser with pydoc and google. I

Re: Python way to printk?

2010-06-09 Thread News123
Hi J, J wrote: > Does anyone know of a way, or have a recipe, to do a linux printk > equivalent in Python? > > I've been googling for a while and not finding anything useful. > > The nutshell version of this is that I need to write a routine for a > test tool I'm working on that will time the am

Re: Non Sequitur: Re: Python Forum

2010-06-08 Thread News123
rantingrick wrote: > On Jun 7, 12:41 am, Steven D'Aprano t...@cybersource.com.au> wrote: > >> "Fish" can be either singular (as in "I fed the fish") or a collective >> noun ("there are many fish that live in salt water"). Plural is "fishes", >> as in "I ate three fishes", although in common use p

Forcing any output (file / stdout) to UTF-8

2010-06-06 Thread News123
Hi, I'm having a small python script printing out UTF-8 characters. # -*- coding: utf-8 -*- print sys.stdout.encoding s=u"abcdéfg" # string containing one non ASCII character # just in case nntp kills it for c in s: print c It work perfectly fine on my utf-8 capable terminal.

Re: Python Forum

2010-06-03 Thread News123
pyDev wrote: > Hello, > > I would like to let the community know that there is a new web-based > forum for Python enthusiasts over at PythonForum.org (http:// > pythonforum.org). Web-based forums is a preferred method by Python > newcomers to get help in exploring the world of Python and programmi

Re: where are the program that are written in python?

2010-05-21 Thread News123
Deep_Feelings wrote: > On May 21, 1:35 pm, Simon Brunning wrote: >> On 21 May 2010 11:21:11 UTC+1, Deep_Feelings wrote: >> >> Seehttp://www.python.org/about/success/ > > thankx for reply. > > from that list i have a feeling that python is acting only as "quick > and dirty work" nothing more ! T

Re: intervall of about 1 second for xmlrpc calls?

2010-05-20 Thread News123
Hi Adam, Adam Tauno Williams wrote: > On Thu, 2010-05-20 at 03:40 -0700, Thomas Lehmann wrote: >>> What's wrong? >> Obviously there's a problem with "localhost". When using the IP of my >> machine everything is working fast. I think you're right. localhost with IPV6 was also a problem for me.

Re: Installing Lightweight Python

2010-05-19 Thread News123
Nima Mohammadi wrote: > Well, I tried to run Python with -v option. It seems that python26.zip > is partially loaded but can't be used, because zlib is "unavailable". This is normal. the zip library itself cannot be zipped, as it is needed to unzip and extract th other libs. > > n...@nima-deskt

Re: client to upload big files via https and get progress info

2010-05-14 Thread News123
Hi J, J.O. Aho wrote: > News123 wrote: > >> What do others do for huge file uploads >> The uploader might be connected via ethernet, WLAN, UMTS, EDGE, GPRS. ) > > Those cases where I have had to move big files it's been scp on those cases > where you just h

Re: client to upload big files via https and get progress info

2010-05-14 Thread News123
Hi James, James Mills wrote: > On Wed, May 12, 2010 at 6:48 PM, News123 wrote: >> Hi, >> >> I'd like to perform huge file uploads via https. >> I'd like to make sure, >> - that I can obtain upload progress info (sometimes the nw is very slow) >&

Re: client to upload big files via https and get progress info

2010-05-14 Thread News123
Hi Sean, Sean DiZazzo wrote: > On May 13, 9:54 pm, Sean DiZazzo wrote: >> On May 13, 9:39 am, News123 wrote: >> >> >> >>> Hi Aaaz, >>> Aahz wrote: >>>> In article <4bea6b50$0$8925$426a7...@news.free.fr>, >>>> News12

Re: client to upload big files via https and get progress info

2010-05-13 Thread News123
Hi Aaaz, Aahz wrote: > In article <4bea6b50$0$8925$426a7...@news.free.fr>, > News123 wrote: >> I'd like to perform huge file uploads via https. >> I'd like to make sure, >> - that I can obtain upload progress info (sometimes the nw is very slow) >>

client to upload big files via https and get progress info

2010-05-12 Thread News123
Hi, I'd like to perform huge file uploads via https. I'd like to make sure, - that I can obtain upload progress info (sometimes the nw is very slow) - that (if the file exceeds a certain size) I don't have to read the entire file into RAM. I found Active states recipe 146306, which constructs t

Re: Cross-platform file paths

2010-05-08 Thread News123
Hi TIA, utabintarbo wrote: > Until now, I have used the UNC under Windows (XP) to allow my program > to access files located on a Samba-equipped *nix box (eg. > os.path.normpath(r"\\serverFQDN\sharename\dir\filename")). When I try > to open this file under Linux (Red Hat 5), I get a file not found

  1   2   3   >