Re: monitor mouse coordinates in real-time

2011-08-14 Thread TheSaint
Jabba Laci wrote: > Could you please help me out how to close the application correctly? > I think you should put a flag into the code, which the parent might modify it, so it will tell the child process to quit. Then the flag should need to be read periodically to know whether is time to quit.

Re: indentation

2011-08-14 Thread TheSaint
Amit Jaluf wrote: > is it necessary indentation in python ? > Try without and report it -- http://mail.python.org/mailman/listinfo/python-list

Re: allow line break at operators

2011-08-10 Thread TheSaint
Yingjie Lan wrote: > #the new way > x = 1+2+3+4+ #line continues as it is clearly unfinished > > 1+2+3+4 > Genrally I prefer this way. > Of course, the dot operator is also included, which may facilitate method > chaining: > > x = svg.append( 'circle' ). Dot-ended is to tiny thing that might c

Re: how to solve it?

2011-08-02 Thread TheSaint
守株待兔 wrote: > from matplotlib.matlab import * maybe you didn't install it http://matplotlib.sourceforge.net/ BTW you haven't mention what version of python you're running. -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension to do os.path.split_all ?

2011-07-29 Thread TheSaint
Alan Meyer wrote: > This is not properly portable to all OS, but you could simply split on > the slash character, e.g., > > pathname.split('/') more portable pathname.split(os.sep) -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommendations for household finance scripting?

2011-07-19 Thread TheSaint
markolopa wrote: > I would like to find a good system to keep track of my household > finance. Do Python programmers have suggestions on that? Do you use > Python to help on this task? libreOffice doesn't do it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread TheSaint
Ian Kelly wrote: > but if somebody later tries to edit the > file using 8-space tabs I came across this and I like to put a note on top of the script to remember to modify it accordingly. -- http://mail.python.org/mailman/listinfo/python-list

Re: why the following python program does not face any concurrency problems without synchronize mechanism?

2011-07-10 Thread TheSaint
smith jack wrote: > have run this program for many times,and the result is always 5050 You might not need to make it in a multiprocess environment Try it in the python (3) shell >>> tot= 0 >>> for k in range(1,100): ... tot += k ... print(tot) ... And watch the risults. -- goto /dev/nul

Re: Finding duplicated photo

2011-07-08 Thread TheSaint
Billy Mays wrote: > It worked surprisingly well even > with just the 64bit hash it produces. > I'd say that comparing 2 images reduced upto 32x32 bit seems too little to find if one of the 2 portrait has a smile referred to the other. I think it's about that mine and your suggestion are similar,

Finding duplicated photo

2011-07-08 Thread TheSaint
Hello, I came across the problem that Gwenview moves the photo from the camera memory by renaming them, but later I forgot which where moved. Then I tought about a small script in python, but I stumbled upon my ignorance on the way to do that. PIL can find similar pictures. I was thinking to re

Re: Problem!!

2011-07-04 Thread TheSaint
Irmen de Jong wrote: > No, I misplaced my crystal ball. I'm waiting mine, brand new in HD :D, with remote control :D :D -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: HOWTO: Parsing email using Python part1

2011-07-03 Thread TheSaint
aspineux wrote: > Hope this help someone. > Yeah I will learn alot and surely applying to my code. Merci Beaucoup -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: How to save a email message?

2011-07-02 Thread TheSaint
Steven D'Aprano wrote: Thank you very much. > But if you seek back to the beginning: > x.seek(0) > 0 x.read() > b'hello' > Found the matter and *is* working I discover another problem: one message contains also a different encoding, but mostly it is not possible to represent that wr

How to save a email message?

2011-07-02 Thread TheSaint
Hello, I'm trying to gather some mail and save it. I don't get why it isn't saved as expected. == >>> import poplib, socket, sys >>> from configparser import Error as ProtocolError >>> args= sys.argv[1:] # this is fake but i

Re: Emails backup in python 3.2

2011-06-22 Thread TheSaint
Michael Hrivnak wrote: > Do you have a special reason for wanting to implement > your own email storage? Learning python :) It seems very easy to get my mails with the poplib help. Usually I work with Kmail which imports mbox files. I'm not prone to set up a SMTP server on my PC. -- goto /dev/

Emails backup in python 3.2

2011-06-21 Thread TheSaint
Hello, I'm looking for an idea how to backup emails retrieved by poplib and save them into mailbox.mbox file. The problem is the received message which is a list of bytes streams, mailbox.mbox don't expect a list. What conversion should I do? A file type io.StringIO ? decoding every bytes stream

Re: How to iterate on a changing dictionary

2011-06-21 Thread TheSaint
Terry Reedy wrote: > Other situations will need other solutions. > Like a job's completion list. Some number of workers get a job, and by time the caller sould know who and what has finished. Then a dictionary would hold number of remaining jobs. Similar a downloading list. -- goto /dev/null

Re: How to iterate on a changing dictionary

2011-06-20 Thread TheSaint
Lie Ryan wrote: Thank you all for the information, really apreciated. > While there are legitimate reasons for iterating a dictionary, I'd > consider the alternatives first. Perhaps the correct answer is in what you said. For certain reasons, searching in a dictionary is the fastest method, se

Re: What would you like to see in a File Organizer ?

2011-06-19 Thread TheSaint
zainul franciscus wrote: > we are looking for > some ideas for good functionality for the application. T I was looking for a file cataloger. this program may go into same category as far as handling file names ad file system's structures. It also manage to store unused files into zipped archives

How to iterate on a changing dictionary

2011-06-19 Thread TheSaint
Hello Trying to pop some key from a dict while is iterating over it will cause an exception. How I can remove items when the search result is true. Example: while len(dict): for key in dict.keys(): if dict[key] is not my_result: dict.pop(key) else: condition_to_brea

Re: What's the best way to write this base class?

2011-06-18 Thread TheSaint
John Salerno wrote: > class Character: I'd vote to point 1 -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Composing regex from a list

2011-06-17 Thread TheSaint
Steven D'Aprano wrote: > def compile_alternatives(*args): Thank you all, for these good points. For my eyes seem that explicit or implicit it will take some looping to concatenate the list elements into a string. I will see pypy later. -- goto /dev/null -- http://mail.python.org/mailman/lis

Composing regex from a list

2011-06-16 Thread TheSaint
Hello, Is it possible to compile a regex by supplying a list? lst= ['good', 'brilliant'. 'solid'] re.compile(r'^'(any_of_lst)) without to go into a *for* cicle? -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Function within class and in modules

2011-06-16 Thread TheSaint
Zach Dziura wrote: > Just repeat this to yourself: Python ISN'T Java I never had to do anything in Java. But mostly something in Sumatra :D I'm getting the point that I'll need class very seldom. Only to understand some more the use of self, whether I'll use a class. -- goto /dev/null -- http:

Function within class and in modules

2011-06-15 Thread TheSaint
Hello sorry, I'm bit curious to understand what could be the difference to pack up a class for some number of functions in it and a simple module which I just import and use the similar functions? The only perspective that I think of is that class might instantiate a function several time. For m

Re: Deditor 0.3.0

2011-06-13 Thread TheSaint
Kruptein wrote: > Deditor is a text-editor for python developers, I'd like a editor that runs programs on trace and highlight the line(s) where it step into. Obviously, if running at normale speed it will disable or if the speed is reduced it will works. -- goto /dev/null -- http://mail.pyth

Re: Handling emails

2011-06-12 Thread TheSaint
Steven D'Aprano wrote: First of all: thanks for the reply >> header =_pop.top(nmuid, 0) > To parse emails, you should use the email package. It already handles > bytes and strings. I've read several information this afternoon, mostly are leading to errors. That could be my ignorance fault :) F

Handling emails

2011-06-12 Thread TheSaint
Hello I wrote a program which was working on python 2.x. I'd like to go for newer version but I face the problem on how the emails are parsed. In particular I'd like to extract the significant parts of the headers, but the query to the servers had turned in to list of bytes. What could be a metho

Re: (*args **kwargs) how do I use' em?

2011-06-11 Thread TheSaint
OliDa wrote: > maybe some clarification about kwargs... > > http://stackoverflow.com/questions/1098549/proper-way-to-use-kwargs-in- python Great point. Now it's clearer :) I think I'll share the dictionary which contains the configuration loaded form a file. -- goto /dev/null -- http://mail.

(*args **kwargs) how do I use' em?

2011-06-10 Thread TheSaint
Hello, I'm seldomly writng python code, nothing but a beginner code. I wrote these lines >> = _log_in= mhandler.ConnectHandler(lmbox, _logger, accs) multhr= sttng['multithread'] if multhr: _log_in= mhandler.mThreadSession(lmbox, _log

Iterating into maildir or mbox

2011-06-09 Thread TheSaint
Hello, originally with python 2.4 ~ 2.7 (I think) iterating a maildir I was using ++Code+ try: mbox= mailbox.PortableUnixMailbox(open(mbox,'r')) except IOError: # if file not found default is None mbox= None while mbox: msg

Re: The pythonic way equal to "whoami"

2011-06-09 Thread TheSaint
Christopher Head wrote: > It is. Until Linux capabilities, EUID==0 used to be special-cased in the > kernel Thank you all, I got a good learning *and* something to rememeber. -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: The pythonic way equal to "whoami"

2011-06-08 Thread TheSaint
Kushal Kumaran wrote: > os.geteuid This return 0 for *root* . I don't know if it's a standard for all distro. Mine is Archlinux. I'd just like to avoid error caused by wrong access by user -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

The pythonic way equal to "whoami"

2011-06-07 Thread TheSaint
Hello, I was trying to find out whose the program launcher, but os.environ['USER'] returns the user whom owns the desktop environment, regardless the program is called by root. I'd like to know it, so the program will run with the right privileges. Is there any standard function on python, that

Re: A simple way to print few line stuck to the same position

2011-06-07 Thread TheSaint
Hans Mulder wrote: > If you use curses, you must initialize it by calling curses.initscr(), > which returns a "WindowObject" representing the konsole window. To > put things on the screen, you call methods on this object. Keep in > mind that a "window" in curses jargon is just a rectangle inside

Re: A simple way to print few line stuck to the same position

2011-06-04 Thread TheSaint
Hans Mulder wrote: > A minimalist solution would be to print the labels ("This count", etc.) > only once, and position the cursor after it to update the report. Generally a good point. Similar sequences are working for coloring and formatting text. I don't know whether the program would behave t

Re: A simple way to print few line stuck to the same position

2011-06-03 Thread TheSaint
Steven D'Aprano wrote: > def spinner(): > chars = '|/-\\' Not exactly. I'd like to show 4~6 line of report and refreshing periodically all of them, avoiding to scroll down. example: this count 50 Second time 90 following line 110 another line xxx The lines should remain on their position and u

A simple way to print few line stuck to the same position

2011-06-02 Thread TheSaint
Hello I studying some way to print few line in the console that won't scroll down. If was for a single line I've some idea, but several line it may take some vertical tab and find the original first position. I don't know anything about course module, some example will be highly apreciated. --

Re: How to catch a line with Popen

2011-05-31 Thread TheSaint
Chris Torek wrote: > Since it is a generator that only requests another line when called, > it should be fine Is it, then, that until the new itaration, the callee is on pause? -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch a line with Popen

2011-05-30 Thread TheSaint
Chris Torek wrote: > In at least some versions of Python 2 I'm with P3k :P. However thank you for your guidelines. Last my attempt was to use a *for* p.wait() , as mentioned earlier That looks good enough. I noted some little delay for the first lines, mostly sure Popen assign some buffer even

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
TheSaint wrote: > I just suppose to elaborate the latest line, as soon it's written on the > pipe, and print some result on the screen. I think some info is also here: http://alexandredeverteuil.blogspot.com/ -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Chris Rebert wrote: > What do you mean by "on-the-fly" in this context I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. Imaging something like p= Popen(['ping','-c40','www.google.com'], stdout=PIPE) for line in p.stdout:

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Tim Roberts wrote: > Are you specifying a buffer size in the Popen command? If not, then the > Python side of things is unbuffered The buffer is as per default. The program reports one line around 1/2 second time. I think I'll look into the option as Nobody states: p = subprocess.Popen

How to catch a line with Popen

2011-05-28 Thread TheSaint
Hello. I'm looking into subprocess.Popen docs. I've launch the program with its arguments and that's smooth. I'm expecting to read the output by *comunicate()* at every line that prgram may blow during the process, but the output is given only when the child process is ended. I'd like to process

Re: how to get PID from subprocess library

2011-05-24 Thread TheSaint
Anssi Saari wrote: > Couldn't you just try to call something via this handle, like > self.handle.aria2.getVersion()? If there's an error, then start aria2 > as a daemon and try again. > Very good, you're right. Furthermore I should avoid to call that function several times. I think to join it w

Re: how to get PID from subprocess library

2011-05-23 Thread TheSaint
GMail Felipe wrote: > For the "ps" command, have you seen the psuti module? > > The link to it is: http://code.google.com/p/psutil/ You gave a brand new start :) I bit of additional program to include into the package ;) -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-lis

Re: how to get PID from subprocess library

2011-05-22 Thread TheSaint
Kushal Kumaran wrote: > You could look for a way to make aria2c not become a daemon and use > subprocess.Popen to start it. That gives you the PID and ways to see > if the process is still running I see. It's a step that I've to get on my account. Unfortunately I'll have to study it some more.

Re: how to get PID from subprocess library

2011-05-21 Thread TheSaint
Kushal Kumaran wrote: > That's how it is able to give you the status. So, if you > are using getstatusoutput, you will have only one instance of your > command running. My intent is to launch only one program instance, which will goes as daemon. To avoid a second call I'd like rather to use Pyth

Re: how to get PID from subprocess library

2011-05-20 Thread TheSaint
Miki Tebeka wrote: > The best module for doing such things is subprocess. And the Popen object > has a pid attribute I knew that, it's my fault that I'm not good to manage with popen. I found simplier to use subprocess.getstatusoutput. Maybe this function doesn't return the child pid, so I shou

how to get PID from subprocess library

2011-05-19 Thread TheSaint
hello, I'm using to launch a program by subprocess.getstatusoutput. I'd like to know whether I can get the program ID, in order to avoid another launch. For clarity sake, I'm calling aria2 (the download manager for linux) and I wouldn't like to call one more instance of it. So what will I use t

Re: Converting a set into list

2011-05-16 Thread TheSaint
Thomas Rachel wrote: > Which loops do you mean here? list(set) has been proved to largely win against list = [] for item in set: list.append(item) or [list.append(item) for item in set] -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a set into list

2011-05-15 Thread TheSaint
Steven D'Aprano wrote: s = set() s.add(42) s.add(42) s.add(42) print s > set([42]) Good to know. I'll remember it -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a set into list

2011-05-15 Thread TheSaint
Chris Torek wrote: > >>> x = ['three', 'one', 'four', 'one', 'five'] > >>> x > ['three', 'one', 'four', 'one', 'five'] > >>> list(set(x)) > ['four', 'five', 'three', 'one'] Why one *"one"* has purged out? Removing double occurences in a list? -- goto /dev/null -- http://mail.python.org/mailman/

Re: Converting a set into list

2011-05-15 Thread TheSaint
SigmundV wrote: > I think the OP wants to find the intersection of two lists. > list(set(list1) & set(list2)) is indeed one way to achieve this. [i > for i in list1 if i in list2] is another one Exactly. I was confused on that I wasn't able to have a list in return. The set intersection is the sm

Trace in a class

2011-05-14 Thread TheSaint
Hello, first of all, I'm a dummy in programming. My methods are just do-it-and-try- it. For more convinience I commonly using and go with step-into and breakpoints. Lately I was setting a class, but it's incomplete and just calling it at the pdb prompt line I can't use breakpoints or stop it to

Re: Converting a set into list

2011-05-14 Thread TheSaint
Ben Finney wrote: > Another method to do what? > Sorry, some time we expect to have said it as we thought it. The example was to show that after having made a set set(aa) the need to get that set converted into a list. My knowledge drove me to use a comprehension list as a converter. In anothe

Re: Converting a set into list

2011-05-14 Thread TheSaint
Peter Otten wrote: > mylist = list(myset) > Do you notice the similarity to converting a list to a set? > There was something confusing me yesterday in doing that, but (for me strangely) I got cleared out. The point was that after a result from: newset= set(myset1) & set(myset2) list= [newset]

Converting a set into list

2011-05-14 Thread TheSaint
Hello I've stumble to find a solution to get a list from a set >>> aa= ['a','b','c','f'] >>> aa ['a', 'b', 'c', 'f'] >>> set(aa) {'a', 'c', 'b', 'f'} >>> [k for k in aa] ['a', 'b', 'c', 'f'] I repute the comprehension list too expensive, is there another method? -- goto /dev/null -- http:/

Re: how to install easy_install

2011-05-14 Thread TheSaint
rusi wrote: > tried to install easy_install (This is on windows) > I downloaded the executable and ran it. It claimed to have done its > job. Perhaps, the abit to just click is disordering some easy steps like copy the script files into the normal place. Only when there's a particular copy then

Re: unicode by default

2011-05-12 Thread TheSaint
John Machin wrote: > On Thu, May 12, 2011 2:14 pm, Benjamin Kaplan wrote: >> >> If the file you're writing to doesn't specify an encoding, Python will >> default to locale.getdefaultencoding(), > > No such attribute. Perhaps you mean locale.getpreferredencoding() what about sys.getfilesystemenco

Re: Py3k,email header handling

2011-05-11 Thread TheSaint
Steven D'Aprano wrote: > Before you re-write it, you should run 2to3 over it and see how much it > can do automatically: Widely done, only the results from some query has radically changed on favour of unicode. Errors raising about results which are not strings anymore. > I'm afraid I don't u

Py3k,email header handling

2011-05-11 Thread TheSaint
Hello, some time ago, I wrote a program to eliminate undesided emails from the server(s) and leave those which comply to certain filter criteria. I started it when I got to know whit Python 2.3. Now a days I'd like to spend some time to improve it, just for my interest, however it didn't gather

Re: A suggestion for an easy logger

2011-05-10 Thread TheSaint
Vinay Sajip wrote: > No, you can pass keyword arguments in any order - that's what makes > them keyword, as opposed to positional, arguments. I getting puzzled :) ==code== myself@laptop-~> python Python 3.2 (r32:88445, Apr 15 2011, 1

Re: A suggestion for an easy logger

2011-05-09 Thread TheSaint
Vinay Sajip wrote: > logging.basicConfig(level=logging.DEBUG, format='%(message)s') logging.basicConfig(format='%(message)s', level=logging.DEBUG) I formulated in the reverse order of arguments, may that cause an unpredicted result? The other points became clearer.. Once again Thank You --

Re: A suggestion for an easy logger

2011-05-08 Thread TheSaint
Vinay Sajip wrote: 8< > For Python 3.2 and later, it's the terminator attribute of the > StreamHandler. See: 8< > Unfortunately, for earlier Python versions, you'd need to subclass and > override StreamHandler.emit() to get equivalent functionality :-( > I'm with 3.2 and willing to stay :) I was

Re: A suggestion for an easy logger

2011-05-07 Thread TheSaint
TheSaint wrote: > I'd like to just have the 4 conditions mentioned in the first post. > OK, my analysis led me to the print() function, which would suffice for initial my purposes. Meanwhile I reading the tutorials, but I couldn't get how to make a formatter to suppress or ke

Re: A suggestion for an easy logger

2011-05-07 Thread TheSaint
Vinay Sajip wrote: WoW :O , the creator !! > import logging > > logging.basicConfig(level=logging.DEBUG) I'm getting there, but the result it's not what I would. As far as I got to know, it should take to write a configuration file, which I still not aware of. I'd like to just have the 4 condi

Re: What other languages use the same data model as Python?

2011-05-07 Thread TheSaint
Gregory Ewing wrote: > because modern architectures are so freaking complicated > that it takes a computer to figure out the best instruction > sequence certainly is, I would not imagine one who writes on scraps of paper :D :D :D -- goto /dev/null -- http://mail.python.org/mailman/listinfo/py

A suggestion for an easy logger

2011-05-07 Thread TheSaint
Hello, I've resumed my hold project and I like to convert it for py3k2. My knowledge has stagnated at version 2.4, then I found some improvements, but it will take me some time before I get used to. I was using this logger >> ===

Re: newbie question: for loop within for loop confusion

2008-06-15 Thread TheSaint
On 09:23, lunedì 16 giugno 2008 takayuki wrote: > word = line.strip() Try word= line.split() and at the end of the loop add one more print to go to new line. -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 05:05, 16-6- 2008 Dennis Lee Bieber wrote: >> # any number of digit followed by 0 or 1 (k or m), case insensitive > > I don't do regular expressions... and the comment doesn't help > "digit followed by 0 or 1", when 0/1 ARE digits themselves... That means either none or one letter, of whi

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 01:15, lunedì 16 giugno 2008 Calvin Spealman wrote: > such as getattr(obj, > methname)(a, b, c). Does this make sense? This is big enlightenment :) Thank you! :) I found problem with eval() when it comes to pass quoted strings. I circumvent that by encapsulating the strings in variable or tup

Re: Configuration files

2008-06-15 Thread TheSaint
On 04:11, domenica 15 giugno 2008 Daniel Fetchinson wrote: > Check this out: http://www.voidspace.org.uk/python/configobj.html > Let me add: cfgparse, iniparse I've look at all to find a simple solution for my interest, but I realized not a good result. I'm using three of them ConfigParser, cfgpa

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 06:34, domenica 15 giugno 2008 Dennis Lee Bieber wrote: >> for nn in stn_items: > I already see a syntax error when viewing that in Agent... A missing > indent level under the "for" The program don't complain wrong indentation, I mostly sure a wrong copy-paste error. Error doesn't com

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 04:08, domenica 15 giugno 2008 [EMAIL PROTECTED] wrote: > what's wrong with getattr(cp, nn) ? The learning curve to get into these programming ways. Does gettattr run the snippet passed in? Considering that nn is a name of function, which will be called and (cfl, value) are the parameters to p

Re: marshal.dumps quadratic growth and marshal.dump not allowing file-like objects

2008-06-15 Thread TheSaint
On 16:04, domenica 15 giugno 2008 [EMAIL PROTECTED] wrote: > cStringIO.StringIO object to marshal.dump() instead but I quickly > learned this is not supported (only true file objects are supported). > > Any ideas about how to get around the marshal quadratic issue? Any > hope for a fix for that

Re: write Python dict (mb with unicode) to a file

2008-06-14 Thread TheSaint
On 17:13, sabato 14 giugno 2008 dmitrey wrote: > hi all, > what's the best way to write Python dictionary to a file? > Pickle or ConfigParser. You may gather more details at http://docs.python.org/lib/persistence.html -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- h

Re: Debuggers

2008-06-14 Thread TheSaint
On 19:21, venerdì 13 giugno 2008 R. Bernstein wrote: > I'm not completely sure what you mean, but I gather that in > post-mortem debugging you'd like to inspect local variables defined at the > place of error. Yes, exactly. This can be seen with pdb, but not pydb. If I'm testing a piece of code a

Re: Checking list by using of exception

2008-06-14 Thread TheSaint
On 15:37, venerdì 13 giugno 2008 Nader wrote: > try: > list_of_files != [] > get the files > For file in list_of_files: try: myfile = open(file, 'r') except (IOError, OSError): print"Your %s file wasn't open" %file # here you can do something with your open file as read

Re: can't assign to literal

2008-06-14 Thread TheSaint
On 17:06, venerdì 13 giugno 2008 Dennis Lee Bieber wrote: > -=-=-=-=-=-=- (make sure you have a fixed width client) > Very good indeed :) Specially to do with block reformatting. I just post my script to demonstrate my thoughts in what I meant as justifying. Specially considering that I meant ch

Hard to understand 'eval'

2008-06-14 Thread TheSaint
Hi, It seems to be strange that give me syntax error inside an eval statement. I'm looking at it carefully but I can't see any flaw. Here it's part of the code: for nn in stn_items: value= eval('cp.%s' %nn) if value and (nn in 'log, trash, multithread, verbose, download')

Debuggers

2008-06-13 Thread TheSaint
Hi, while testing my program I found some strange happening with pdb and pydb. I like pydb because let me restart the program and nicer features, but if errors pop up, then it will forget all variables (globals and locals gone). I've to go for pdb because it isn't affected by that problem, but al

My editing style (was: can't assign to literal)

2008-06-13 Thread TheSaint
On 14:49, giovedì 12 giugno 2008 Chris wrote: > You should strip all extraneous white space from code though. For my taste, trailing spaces will be removed by my editor (Kate :) ) Other space tabulators are an issue which won't suite my needs. -- Mailsweeper Home : http://it.geocities.com/call_

Re: can't assign to literal

2008-06-13 Thread TheSaint
On 15:11, giovedì 12 giugno 2008 Dennis Lee Bieber wrote: > Word spaced line justification is only feasible if one is using a > fixed width font and have a line length defined in "characters/line". ===8<==8<==8<==8<==8<==8<==8<==8<==8<==8< line= 'fixed width f

Re: My fight with classes :)

2008-06-12 Thread TheSaint
On 17:47, giovedì 12 giugno 2008 Bruno Desthuilliers wrote: >>> For multiple functions, use classes. > > Well... Closures are poor men's objects, or so they say (or is that the > other way round ?-). Well, I'd like to know what could be the reason to design a single-call class instead of a simil

Re: My fight with classes :)

2008-06-12 Thread TheSaint
On 04:51, giovedì 12 giugno 2008 Terry Reedy wrote: First of all a big thank you, all. > def makeappender(): > data = ['',''] > def appender(val): > > return appender I'll give it a try. I just doubting if the data will be shared outside the function. Actually, my practice goes to send all vari

Re: can't assign to literal

2008-06-11 Thread TheSaint
On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote: > Do you mean indenting, or wrapping? I mean fill the line by increasing spaces between words in order to get a paragraph aligned both side, left and right on the page. So if the width is 78 chars it wouldn't have jig saw end to the right side,

Re: can't assign to literal

2008-06-11 Thread TheSaint
On 00:15, giovedì 12 giugno 2008 Ethan Furman wrote: > I like Vim (Vi Improved) What about justifying text ? -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: catastrophic regexp, help!

2008-06-11 Thread TheSaint
On 12:20, mercoledì 11 giugno 2008 cirfu wrote: > patzln = re.compile("(\w* *)* zlatan ibrahimovic (\w* *)*") I think that I shouldn't put anything around the phrase you want to find. patzln = re.compile(r'.*(zlatan ibrahimovic){1,1}.*') this should do it for you. Unless searching into a specia

Re: can't assign to literal

2008-06-11 Thread TheSaint
On 16:47, mercoledì 11 giugno 2008 Chris wrote: > SciTE and Notepad++ Pype, spe, just to point it out. Jedit, but rather a bloatware. I'd like to know which is the litest multi platform and indipendent. Pype is very good when compiled in exe, but not doing in Linux in that way. -- Mailsweeper Ho

My fight with classes :)

2008-06-11 Thread TheSaint
Hi, I'm very new with classes. I still reading something around ;) I got started to try a concatenation of 2 type of string, which have a particular property to start with A or D. My class here: """ Small class to join some strings according to the leading first letter""" def __init

Re: Python doesn't understand %userprofile%

2008-06-10 Thread TheSaint
On 00:11, mercoledì 11 giugno 2008 Tim Golden wrote: > "%USERPROFILE%/dir/file". os.environ('USERPROFILE') should return an info regarding that environment variable. I guess that, not yet tried. -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/ma

Re: ConfigObj quoting issues

2008-06-03 Thread TheSaint
On 14:25, martedì 03 giugno 2008 Roopesh wrote: > This error is because of the presence of \', \", \n etc. > > I had to do the following to make it work. > address[i].replace("\'",'').replace('\"','').replace('\n','') > it's rather ugly :) I suggest use re module as follow: import re address[i]

Re: Formatting Output

2008-06-03 Thread TheSaint
On 06:15, martedì 03 giugno 2008 Mensanator wrote: > In Access, I create a query with this SQL: But this isn't python itself. I'd like to see a small function to let 'locate' the cursor into a TTY console. Surely it can't scroll. If it is not possible, then ncurses is the way. I don't know if it w

Re: Shed my a light :)

2008-06-02 Thread TheSaint
On 22:00, lunedì 02 giugno 2008 Paul Melis wrote: > This doesn't exactly make sense, as what you want isn't really clear... Sorry, I'm bad to express my toughts even I my nature language :) I'll give a go to getattr() and see whether the results come in my taste :) -- Mailsweeper Home : http://i

Re: Shed my a light :)

2008-06-02 Thread TheSaint
On 19:06, lunedì 02 giugno 2008 Chris wrote: >> actions= ('print', 'sum', 'divide', 'myfunction') >> parameters=(5, 'nothing',5.63, object) 8< 8< > getattr(...) > getattr(object, name[, default]) -> value 8< 8< > for nn in actions: > func = getattr(cp, nn) > if callable(func): >

Shed my a light :)

2008-06-02 Thread TheSaint
Hi, I using eval for quite strange reason, as long as I don't know a different way to implement. An example: actions= ('print', 'sum', 'divide', 'myfunction') parameters=(5, 'nothing',5.63, object) for routines in actions: routines(parameters) I'd like to note that actions are string or st

Re: [Business apps for Windows] Good grid + calendar, etc.?

2008-06-01 Thread TheSaint
On 19:59, domenica 01 giugno 2008 Gilles Ganault wrote: > require rich widgets like (DB)grids, calendars, etc. Qt seems to go a bit further. Try Eric4 as SDK. -- Mailsweeper Home : http://it.geocities.com/call_me_not_now/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: File browser in python gui

2008-06-01 Thread TheSaint
On 02:48, domenica 01 giugno 2008 TheSaint wrote: > I'm gonna back to study a little I'm facing tough time, I can't get clear by Trolltech's C++ examples. I'm a bit puzzled :), I'd like to remain with the QT widget set, but hard learning curve. Other simplified d

Re: SMS sending and receiving from website?

2008-05-31 Thread TheSaint
On 22:01, sabato 31 maggio 2008 globalrev wrote: > also, lets say i want to send a SMS to my own phone from the internet. > how would i do that? IMO, nowadays free SMS sending, via internet, is gone. There should be the chance from one's own subscribed network. -- Mailsweeper Home : http://it.ge

  1   2   >