Re: List text files showing LFs and expanded tabs (was: Colorize expanded tabs)

2005-12-14 Thread qwweeeit
Hi Gene, thank you for your reply, also if my post was meant to be only an exercise to apply color to lfs and expanded tabs in listing files and not to apply it to an editor. However your comment has directed me to consider more deeply other editors (I use kwrite). I am inclined to change to vim

List text files showing LFs and expanded tabs (was: Colorize expanded tabs)

2005-12-12 Thread qwweeeit
Hi all, in a previous post I asked help for colorizing expanded tab. I wanted to list text files showing in colors LFs and the expanded tabs. I hoped to use only bash but, being impossible, I reverted to Python. I programmed a very short script . Here it is (... and I ask comments or critics): #

Colorize expanded tabs

2005-12-04 Thread qwweeeit
Hi all, from a string embedding tabs I want to colorize them when expanded: # Starting from a string: a= '1234\t5678\t\t90\nqwerty\nasdfg' # which embeds both tabs and lfs # printing it you obtain: print a # 1234567890 # qwerty # asdfg # print automatically expands tabs and

Re: Colorize expanded tabs

2005-12-04 Thread qwweeeit
Hi Peter, thank you for your replay, but I was looking for a very short routine. I even had in mind to use Linux bash (only one command line). It seems that tab expansion, made by print, prevents the working of the escape sequences for colors. In fact, if you replace tab with a given number of

Re: Web automation

2005-11-09 Thread qwweeeit
Hi Mike, thank you very much for your reply. I know that mine could be considered a very silly way to define automation. but I'm not a purist nor a professional programmer. Besides that, I know that case by case every problem can be solved and in more right way, also in very difficult

Re: Web automation

2005-11-08 Thread qwweeeit
Hi all, answering to Mike Meyer who replied to the following assertion on my part: but I supposed the everyone knew that web automation (and in general automation) is only a problem in Linux. with...: I don't know it. I don't believe it, either. I automate web tasks on Unix systems (I don't

Re: Web automation (was: Pressing a Webpage Button)

2005-11-07 Thread qwweeeit
Hi all, I must correct myself: With such a method you can bypass the Google's restrictions, because you are using the browser (only building automatically the query). Of course that's not correct because you are using a program (twill) different from a browser and if google controls from where

Re: Using Which Version of Linux

2005-11-05 Thread qwweeeit
Hi Michael, I too use SUSE (9.3). The Novell operation has convinced me to go back to SUSE, after some trials with Mandrake and Ubuntu. Especially on the Python side all is ready up. But I will not go into the complications of fork and thread programming... Bye. --

Re: Web automation with twill

2005-11-04 Thread qwweeeit
Hi Michele, I taught to be the smartest in town! But when the experts take the field it is better that us newbies retire in good order... Thank you for your article and, with respect to Grig Gheorghiu (another expert), I must apologize for having be a little rude. I hadn't discovered in Internet

Re: Web automation with twill

2005-11-04 Thread qwweeeit
Hi Michele, I only made the observation about Zope, because I hoped to hear a different point of view as you are/were involved in web development using Zope/Plone (as referred in your article...). Besides that, at a Linux Day, I followed a presentation of Zope/Plone framework, which stroke me a

Re: Filepath string manipulation help

2005-11-03 Thread qwweeeit
Hi mjakowlew, to get file basename in Linux I use simply: filepath.split('/')[-1] But in Windows, being the dir separator '\', you get into trouble if the dir or file name begins with one of the escape sequences: \a ASCII Bell(BEL) \x07 \b ASCII Backspace (BS) \x08 \f

Web automation (was: Pressing a Webpage Button)

2005-11-03 Thread qwweeeit
with the query to Google: http://www.google.it/search?hl=itie=ISO-8859-1q=twillbtnG=Cerca+con+Googlemeta= - save the search result on a file: save_html /home/qwweeeit/searching_twill.html Here they are the 1st 10 hits of the search! Don't ask me to continue! Perhaps asking to the author of twill (C

Web automation with twill

2005-11-02 Thread qwweeeit
Hi all, this post is a kind of continuation of my Expanding Python as a macro language Among the replies [EMAIL PROTECTED] directed me to: http://www.idyll.org/~t/www-tools/twill.html (a python tool with a language to script web commands) I applied twill to a problem I had solved by hand

Re: Web automation with twill

2005-11-02 Thread qwweeeit
I solved the problem by myself with the classical method of newbyes (trial and error). Bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: Expanding Python as a macro language

2005-10-31 Thread qwweeeit
I am further commenting on new replies. Mike Meyer wrote: In general, application scripting facilities are one thing that Unix hasn't dealt with well. ...so each application is left up to it's own devices. Some of them now export APIs that can be hooked up to a variety of languages. Now I

Re: Expanding Python as a macro language

2005-10-29 Thread qwweeeit
Thank you for your replays (both for WMI and AutoIt beta-release) but I would be satisfied if I had in Linux something similar to the standard version of AutoIt! Concerning WMI, a part the fact that it works only under Windows, from the examples I have seen, IMHO it is much less powerful than

Re: Expanding Python as a macro language

2005-10-29 Thread qwweeeit
Thank you for your replays (both for WMI and AutoIt beta-release) but I would be satisfied if I had in Linux something similar to the standard version of AutoIt! Concerning WMI, a part the fact that it works only under Windows, from the examples I have seen, IMHO it is much less powerful than

Re: Expanding Python as a macro language

2005-10-29 Thread qwweeeit
At first you must forgive my double posting (4 5 in terms of date and 4 7 in terms of answers). I must then thank the new comers: Michael, Alex Martelli and Mike Meyer. Michel wrote: [EMAIL PROTECTED] wrote: But then I changed idea... Also if it is already one year that I try to find a

Expanding Python as a macro language

2005-10-28 Thread qwweeeit
Hi all, when I moved from Windows to Linux I choosed Python as my language of reference and as GUI, Qt (not much investigated up to now). Till now I didn't regret but one thing: Python can't act as a macro language and so you are obliged to revert to Windows to use programs like AutoIt,

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-17 Thread qwweeeit
Hi Claudio, I fully agree with you. I already used AutoIt 3 but when I moved to Linux I wasn't able to find anything similar. I moved also to Python for its power but also if it is called a scripting language it doesn't simply interact with graphical applications. As a last resort I tried DCOP

Re: dcop module under Python 2.4

2005-10-10 Thread qwweeeit
Hi Diez, thank you for your replay, but I didn't succeed (I am almost a newbye). So I solved the problem in another manner: I changed distribution from kubuntu to SUSE 9.3 (base installation). Now I can import dcop and also pcop. Bye. -- http://mail.python.org/mailman/listinfo/python-list

Works only in interactive mode

2005-10-10 Thread qwweeeit
Hi all, using Python 2.4 under Linux (SUSE 9.3) I was developping a script to get various lists related with DCOP. In interactive Python all is working correctly: import pcop # application's registration with DCOP x=pcop.register_as('kate') print x kate-7497 # list of DCOP registered

Re: Works only in interactive mode

2005-10-10 Thread qwweeeit
Hi Sam, thank you very much. Your diagnosis was perfect! Bye. -- http://mail.python.org/mailman/listinfo/python-list

dcop module under Python 2.4

2005-10-06 Thread qwweeeit
Hi all, at the end I upgraded to 2.4, but now I am not able to load dcop module (part of the Python-KDE3 bindings). Any help? Bye. -- http://mail.python.org/mailman/listinfo/python-list

Initializing interactive Python

2005-07-24 Thread qwweeeit
Hi all, is it possible to enter an interactive session and automatically do some initialization? I explain better: I want that when I start interactive Python on a console (I use Linux) two command lines be executed automatically: Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux

Re: Initializing interactive Python

2005-07-24 Thread qwweeeit
Hi Bruno, thank you...Easy as pie !-) Bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: What does :: mean?

2005-07-20 Thread qwweeeit
Hi Robert, I didn't succeed in reversing a string with the full form you proposed: live[len(live)-1:-1:-1] # where live=live The result is an empty string. To reverse live (in a full form), I have to put a char in front of the string and...: ('x'+live)[len(live)+1:0:-1] # -- evil Is it due

Re: Splitting on a word

2005-07-14 Thread qwweeeit
Hi all, thanks for your contributions. To Robert Kern I can replay that I know BeautifulSoap, but mine wanted to be a generalization (only incidentally used in a web parsing application). The fact is that, beeing a macho newbie programmer (the macho is from Steven D'Aprano), I wanted to show how

Re: Splitting on a word

2005-07-14 Thread qwweeeit
Hi Bernhard, firstly you must excuse my English (angry is a little ...strong, but my vocabulary is limited). I hope that the experts keep on helping us newbie. Also if I am a newbie (in Python), I disagree with you: my solution (with the help of Joe) answers to the problem of splitting a string

Splitting on a word

2005-07-13 Thread qwweeeit
Hi all, I am writing a script to visualize (and print) the web references hidden in the html files as: 'a href=web reference underlined reference/a' Optimizing my code, I found that an essential step is: splitting on a word (in this case 'href'). I am asking if there is some alternative (more

Re: Python, mysql, floating point values question

2005-07-02 Thread qwweeeit
Hi Christopher, if you have to make calculations or comparing operations, the only safe method is to save and use only integer values. Of course there must be a preventive agreement on the precision you want to have (2, 3 4 ... decimals). The sw part is straigthforward: - to save in the database

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread qwweeeit
Hi, About the error, you already got the answer from the experts. Beeing almost a newbie, I tried instead an elaboration of your example, using lists. Furthermore I timed the two methods and to my surprise the list method takes longer: # Head_Tail.py import random, time nStart= time.time() #

Re: noob question

2005-06-26 Thread qwweeeit
Hi Matt, I also am almost a newbie (in Python) and my approach to variable naming follows more or less the Hungarian Type Notation Defined. To better explain, I use one char or two (in small case) as a prefix of the name of the variable (starting in capital letters). The prefix identifies the type

Re: Create our own python source repository

2005-06-21 Thread qwweeeit
Hi datacide, before, the good part...: thank you for your replay. Your suggestion has opened me a new worldl: an alternative method to get web resources. Now the bad part: your is an example of guru's suggestion, that is a few words from which the poor newbye can't exctract much. It is much more

Re: How to right align IPaddress?

2005-06-17 Thread qwweeeit
IPnumber.rjust(15) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to right align IPaddress?

2005-06-17 Thread qwweeeit
Hi, the solution is a little more involved, if you want to right justify each of the four components of IP number: import sys try: .sIPnumber=sys.argv[1] except: . sys.exit(-1) list_lPcomponents=sIPnumber.split('.') sRJ='' for n in list_IPcomponents: . sRJ+=n.rjust(3)+'.' print sRJ[:-1]

Create our own python source repository

2005-06-07 Thread qwweeeit
Hi all, beeing almost a newbie, I am trying to learn from experts. For that reason I am collecting examples of Python sources (and Pythonic way of programming...) on a CD, ready to be searched. By now, I extracted from web (using wget) all the examples of Cookbook Python (35 Mb!). After some

Re: Create our own python source repository

2005-06-07 Thread qwweeeit
Hi Rob, thank you for your reply. I am further commenting on your doubts (I'm not entirely sure what the point of your exercise is) and on your proposal of a project for more structured tutorials. About the second item, I fully agree with you. I should be even more drastic: for a certain argument

File list from listdir or shell?

2005-05-26 Thread qwweeeit
Hi all, to obtain a file list from a dir you can use: import os, sys try: . sExtension=sys.argv[1] . sPath=sys.argv[2] except: . sExtension= . sPath='.' lF=os.listdir(sPath) # to remove from the list also the names of backup files lF=filter(lambda lF: '~' not in lF and sExtension in lF,lF)

Re: ANN: Veusz 0.6 - a scientific plotting package

2005-05-21 Thread qwweeeit
Hi Jeremy, I am interested in collaborating to your project, but first of all I must install Veusz and see what is the feeling I get. I'm almost a newbie in Python but I'm an old programmer and have quite a lot of experience in designing scientific software. For example I know very well contour

Re: We are one of the world leading legal sources for male impotence treatments

2005-05-21 Thread qwweeeit
I should need a great errrect1on ... but get away from beeing permanently on the top of the list! -- http://mail.python.org/mailman/listinfo/python-list

Self-modifying Code

2005-05-19 Thread qwweeeit
Hi all, when I was young I programmed in an interpreted language that allowed to modify itself. Also Python can (writing and running a module, in-line): fNew =open(newModule.py,'w') lNew=['print 123\n','print 454\n','print 789\n'] fNew.writelines(lNew) fNew.close() from newModule import *

Re: Convert from numbers to letters

2005-05-19 Thread qwweeeit
Hi rh0dium, Your request gives me the opportunity of showing a more realistic example of the technique of self-modification coding. Although the coding is not as short as that suggested by the guys who replayed to you, I think that it can be interesting # newVars.py lCod=[] for n in

Re: newbie running IDLE with command line arguments

2005-05-18 Thread qwweeeit
Hi, I apologize not to have answered to your question in a coherent way. I can take as excuses that I don't know English very well or that I was mistaken by the fact that you refer a piece of code with the error traceback (instead of simply asking for how entering command parameters in IDLE).

Offline debuggimg

2005-05-18 Thread qwweeeit
Hi all, with my last initiative (logging by intercepting open calls) I succeded (with the essential help of Fredrik Lundh), but I must confess that the method is too complicated... I think that a better result could be obtained by offline debugging. I explain: debugging is mainly an interactive

Re: newbie running IDLE with command line arguments

2005-05-17 Thread qwweeeit
Hi, also if you print only 'host', running the script, you have to pass all the 3 parameters, like: python socket_script.py myserver 567 'All is OK!' The parameter sys.argv[0] is of course the script 's name (in this example: socket_script.py) Bye. --

Re: Modifying a built-in function for logging purposes

2005-05-15 Thread qwweeeit
. In the test I carried on the answer was: OPEN ('pippo2',) FROM ? IN /home/qwweeeit/app.py OPEN ('pippo3', 'w') FROM ? IN /home/qwweeeit/app.py OPEN ('pippolong', 'w') FROM ? IN /home/qwweeeit/app.py I have not tested yet if multi-module applications answer in terms of modules. I must thank also Bengt

Re: Mandrake 10.1 and Python 2.3.4

2005-05-15 Thread qwweeeit
Hi Joal, I can only tell you that in my Linux Mandrake 10.1 (Community Edition), all is ok: Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2 Type help, copyright, credits or license for more information. import site dir (site) ['_Helper',

Re: mod_python and logging

2005-05-15 Thread qwweeeit
Hi Daniel, look at the thread I started (Modifying a built-in function for logging purposes).

Re: Modifying a built-in function for logging purposes

2005-05-14 Thread qwweeeit
Hi Greg, thank for your replay, but I didn't succeed in any way. You must consider however that I'm not a Python expert... IMHO, it must be a script that change part of the interpreter, and substitute a new module (py) in the place of the standard one (py or pyc). The standard module must be saved

MySQL application example

2005-05-13 Thread qwweeeit
Hi all, I have in mind to learn to use MySQL, not only to use it myself but also to persuade a friend of mine to use Python and MySQL and abandon Informix and its old fashioned language (and also SCO UNIX to migrate to Linux). Apart reading tutorials, I have found that the best thing to learn a

Re: Importing modules

2005-05-12 Thread qwweeeit
Hi all. Steve Holden wrote: ... to conflict with the can't teach an old dog new tricks ... Excuse my English (also some terms of your replay have no correspondance in my English dictionary...) and my lack of patience (beeing an old dog ...). My original request was mainly centered on flow

Re: Importing modules

2005-05-12 Thread qwweeeit
Hi Fredrik, thank you for saying that I am ... posting silly assertions. I didn't born Python expert, and I am hardly trying to learn something. I don't like classes but this assertion (silly... I agree) is due to the fact that I don't understand them well (I hope to change mind in a near

Importing modules

2005-05-11 Thread qwweeeit
The pythonic way of programming requires, as far as I know, to spread a big application in plenty of more manageable scripts, using import or from ... import to connect the various modules. In some cases there is a further complication: module importing through an indirect mechanism, like: exec

Re: Strip white spaces from source

2005-05-10 Thread qwweeeit
Hi Richie, I did not post my solution because I did not want to pollute the pythonic way of programming. Young programmers, don't follow me! I hate (because I am not able to use them...) classes and regular expressions. Instead I like lists, try/except (to limit or better eliminate debugging) and

Re: Strip white spaces from source

2005-05-09 Thread qwweeeit
Hi Richie, thank you for your answer. Your solution is interesting but does not take into account some white spaces (like those after the commas, before or after mathematical operands etc...). Besides that I'm a almost a newbie in Python, and I have the very old programmers' habits (I don't use

Controlling kwrite by dcop

2005-05-08 Thread qwweeeit
Hi all, in my cross-reference tool I have the need to highlight the variables (by printing them in bold). I am using the kwrite editor, and I am not able to control it from python. I was thinking of various solutions: - consider the text file as html and use b.../b - use LaTex - define a new

Strip white spaces from source

2005-05-08 Thread qwweeeit
Hi all, I need to limit as much as possible the lenght of a source line, stripping white spaces (except indentation). For example: . . max_move and AC_RowStack.acceptsCards ( self, from_stack, cards ) must be reduced to: . . max_move and AC_RowStack.acceptsCards(self,from_stack,cards) My

Re: whitespace , comment stripper, and EOL converter

2005-04-16 Thread qwweeeit
Hi, At last I succeded in implementing a cross reference tool! (with your help and that of other gurus...). Now I can face the problem (for me...) of understanding your code (I have not grasped the classes and objects...). I give you a brief example of the xref output (taken from your code,

Re: whitespace , comment stripper, and EOL converter

2005-04-16 Thread qwweeeit
Hi, Importing a text file from another o.s. is not a problem : I convert it immediately using the powerful shell functions of Linux (and Unix). I thank you for the explanation about classes, but I am rather dumb and by now I resolved all my problems without them... Speaking of problems..., I

Re: whitespace , comment stripper, and EOL converter

2005-04-15 Thread qwweeeit
Hi, I have no more need to corret my code's bugs and send to clp group a working application (I don't think that there was an eager expectation...). Your code is perfectly working (as you can expect from a guru...). Thank you and bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing comments... tokenize error

2005-04-13 Thread qwweeeit
Thanks! If you answer to my posts one more time I could consider you as my tutor... It was strange to have found a bug...! In any case I will not go deeper into the matter, because for me it's enough your explanatiom. I corrected the problem by hand removing the tokens spanning multiple lines

Re: Removing comments... tokenize error

2005-04-13 Thread qwweeeit
My code, besides beeing cumbersome and criptic, has another quality: it is buggy! I apologize for that; obviously I discovered it after posting (in the best tradition of Murphy's law!). When I will find the solution I let you know, also if the problem is made difficult for the fact that the for

Removing comments... tokenize error

2005-04-12 Thread qwweeeit
In analysing a very big application (pysol) made of almost 100 sources, I had the need to remove comments. Removing the comments which take all the line is straightforward... Instead for the embedded comments I used the tokenize module. To my surprise the analysed output is different from the

Re: remove strings from source

2005-03-21 Thread qwweeeit
I am in debt with you of an answer on my solution in removing literal strings... I apologize not to have followed your suggestions but I am just learning Python, and your approach was too difficult for me! I've already developed the cross reference tool, and for that I identified two types of

Re: Splitting with Regular Expressions

2005-03-19 Thread qwweeeit
It' s my faute that I have not read more deeply the Library Reference... In any case the time wasted in developping small applications to number lines and remove comments, triple quoted strings, multiline instructions etc. has been useful to learn the language... Now I already have the single

Re: Splitting with Regular Expressions

2005-03-18 Thread qwweeeit
I thank you for your help. The more flexible solution (Paul McGuire) is interesting but i don't need such a flexibility. In fact I am implementing a cross-reference tool and working on python sources, I don't need the '.' as separator in order to capture variables and commands. I thank

Re: Split text file into words

2005-03-09 Thread qwweeeit
I thank you for your help. I already used re.split successfully but in this case... I didn't explain more deeply because I don't want someone else do my homework. I want to implement a variable commands cross reference tool. For this goal I must clean the python source from any comment and

Split text file into words

2005-03-08 Thread qwweeeit
The standard split() can use only one delimiter. To split a text file into words you need multiple delimiters like blank, punctuation, math signs (+-*/), parenteses and so on. I didn't succeeded in using re.split()... -- http://mail.python.org/mailman/listinfo/python-list

Re: Another math problem...

2005-03-06 Thread qwweeeit
Sorry, in writing down the problem and the corresponding solution, I made a mistake. It's evident, but anyway... Wrong: # ab * cb = dab 35 * 26 = 936 # + + - + + - # ifd + chg = eaf179 + 258 = 437 # ---

Another math problem...

2005-03-04 Thread qwweeeit
Another math problem easier to solve by hand, but, IMHO, difficult to program in a concise way like the solution of Bill Mill (linalg_brute.py) to the problem of engsol. I appreciated very much the Bill Mill's solution and that inspired in a certain way the solution for my problem. # Problem and

remove strings from source

2005-02-26 Thread qwweeeit
For a python code I am writing I need to remove all strings definitions from source and substitute them with a place-holder. To make clearer: line 45 sVar=this is the string assigned to sVar must be converted in: line 45 sVar=s1 Such substitution is recorded in a file under: s0001[line

Re: remove strings from source

2005-02-26 Thread qwweeeit
Thank you for your suggestion, but it is too complicated for me... I decided to proceed in steps: 1. Take away all commented lines 2. Rebuild the multi-lines as single lines I have already written the code and now I can face the problem of mouving string definitions into a data base file...

Re: Shift Confusion

2005-02-24 Thread qwweeeit
At programming level it seems correct (a part a return closure needed for the main function). But the error is IMHO conceptual: for a char you need 7 bits (from 0 to 127 or in hex from x00 to x7F) and you can't accomodate the other char in only one bit! The other 128 symbols (from 128 to 255 or

Flow chart (function tree) cross references

2005-02-22 Thread qwweeeit
Hi all, I am developing in Python (as a GUI I choosed Qt). To increase my expertise, besides reading manuals tutorials, I am studying a big program developed in the language of my choice, and related with my project (to develop a card game). For that reason I choosed PySol (also if the GUI part

PySol: using Qt (as a case study)

2005-02-07 Thread qwweeeit
PySol uses TKinter as GUI system. Wanting to learn python I am studying PySol, but having choosed Qt as my GUI, I am asking if someone can comment on my choice both on pysol as as an application worth to study (I want to implement a card game) and mainly on Qt choice. Perhaps it would be better

Re: PySol: using Qt (as a case study)

2005-02-07 Thread qwweeeit
It must be the Free Software Foundation that has to take in charge the problem (as I know it has already done in some cases)... -- http://mail.python.org/mailman/listinfo/python-list