Re: python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
Incidentally, I noticed something about the environment: in my script, I use the LINES and COLUMNS environment vars that are set in my shell: columns=int(os.environ.get("COLUMNS")) lines=int(os.environ.get("LINES")) In the shell, I get $ echo $LINES $COLUMNS 89 199 but python doesn't get these

Re: python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
To really be sure that the problem is when I use python, I tried in C: #include #include int main(void) { initscr(); /* Start curses mode */ // printw("àéïoù"); /* Print Hello World */ addstr("àéïoù");/* Print Hello World */ refresh(); /* Print it o

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
On 2007-01-27, Thomas Dickey <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: >> I don't really expect it to work, but if anything will, that >> is it. Curses supports only ASCII and a some special symbol >> codes defined by curses. > > un - no. Curses supports whatever the fla

Re: python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
My system is Linux, and the distribution is Slackware 10.1. I have /lib/libncurses.so.5.4 /lib/libncursesw.so.5.4 so I even have the wide-chars version available. Any hint on the python configuration? I didn't find any function that would allow the unrestricted display of 8-bit chars. -- Fabri

Re: Convert String to list of chars

2007-01-26 Thread Neil Cerutti
On 2007-01-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How can I convert a string to a char list? > for example > > "hello" --> ['h','e','l','l','o'] > > I have been searching but I can't find my answers list("hello") -- http://mail.python.org/mailman/listinfo/python-list

Re: Do not feed the trolls

2007-01-26 Thread thermate2
On Jan 26, 10:00 pm, Skywise <[EMAIL PROTECTED]> wrote: > The #1 best thing you can do for these kind of posts is to 100% > ignore them. If that gives them the freedom of speech and you the ignorance of bliss, why not > All they want is the response. It matters not what you say. > Every response

Convert String to list of chars

2007-01-26 Thread juanefren
How can I convert a string to a char list? for example "hello" --> ['h','e','l','l','o'] I have been searching but I can't find my answers thanks -- Juan Efrén Castillo Encinas -- http://mail.python.org/mailman/listinfo/python-list

wx Python event question

2007-01-26 Thread dudds
Hi I really haven't used wxPython before and I was just wondering if there was some sort of timer event that can be used. For example if I have a database that I want to query at regular intervals and display the results in a window is that possibly to do under a wx Python program? So far I have c

Re: dict.keys() ?

2007-01-26 Thread George Sakkis
On Jan 26, 10:04 pm, [EMAIL PROTECTED] wrote: > The PEP 3100:http://www.python.org/dev/peps/pep-3100/ > says: > > Return iterators instead of lists where appropriate for atomic type > methods (e.g. dict.keys(), dict.values(), dict.items(), etc.); iter* > methods will be removed. Better: make keys(

Re: instancemethod

2007-01-26 Thread Michele Simionato
On Jan 27, 6:39 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > It seems that the description of __new__ is wrong. Since __new__ takes an > implicit first argument, the class, it is a class method, not a static > method. No: >>> class C(object): ...def __new__(cls): pass >>> C.__dict__['_

Re: strip question

2007-01-26 Thread John Machin
On Jan 27, 4:33 pm, [EMAIL PROTECTED] wrote: > hi > can someone explain strip() for these : > [code]>>> x='www.example.com' > >>> x.strip('cmowz.')'example' > [/code] According to the documentation (with emphasis added): """Return a copy of the string with the *leading* and *trailing* character

Re: strip question

2007-01-26 Thread James Stroud
Steven D'Aprano wrote: > On Fri, 26 Jan 2007 21:33:47 -0800, eight02645999 wrote: > > >>hi >>can someone explain strip() for these : >>[code] >> >x='www.example.com' >x.strip('cmowz.') >> >>'example' >>[/code] >> >>when i did this: >>[code] >> >x = 'abcd,words.words' >x.strip(',.'

Re: strip question

2007-01-26 Thread Steven D'Aprano
On Fri, 26 Jan 2007 21:33:47 -0800, eight02645999 wrote: > hi > can someone explain strip() for these : > [code] x='www.example.com' x.strip('cmowz.') > 'example' > [/code] > > when i did this: > [code] x = 'abcd,words.words' x.strip(',.') > 'abcd,words.words' > [/code] > > i

Re: help with subscription to a process

2007-01-26 Thread Paul Hummer
The Python socket module, although lightweight, can be used to quickly establish a socket between client and server for the purpose of feeding data. I've done this once or twice with XML. If you are looking for something a bit more robust, might I suggest reading up on the Twisted libraries? Pau

Re: strip question

2007-01-26 Thread James Stroud
[EMAIL PROTECTED] wrote: > hi > can someone explain strip() for these : > [code] > x='www.example.com' x.strip('cmowz.') > > 'example' > [/code] > > when i did this: > [code] > x = 'abcd,words.words' x.strip(',.') > > 'abcd,words.words' > [/code] > > it does not strip off ","

Re: instancemethod

2007-01-26 Thread Steven D'Aprano
On Sat, 27 Jan 2007 01:03:50 -0300, Gabriel Genellina wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> escribió en el > mensaje > news:[EMAIL PROTECTED] > >> On Fri, 26 Jan 2007 17:25:37 +0100, Bruno Desthuilliers wrote: def __del__(self): try: self.close() >>>

Re: instancemethod

2007-01-26 Thread Steven D'Aprano
On Fri, 26 Jan 2007 20:27:29 -0800, Michele Simionato wrote: > On Jan 22, 2:58 am, "Gert Cuykens" <[EMAIL PROTECTED]> wrote: > >> http://www.faqts.com/knowledge_base/view.phtml/aid/16824 > > There is a factual mistake on that reference. The last sentence > >> One final note: the single most com

strip question

2007-01-26 Thread eight02645999
hi can someone explain strip() for these : [code] >>> x='www.example.com' >>> x.strip('cmowz.') 'example' [/code] when i did this: [code] >>> x = 'abcd,words.words' >>> x.strip(',.') 'abcd,words.words' [/code] it does not strip off "," and "." .Why is this so? thanks -- http://mail.python.org/m

Re: instancemethod

2007-01-26 Thread Michele Simionato
On Jan 22, 2:58 am, "Gert Cuykens" <[EMAIL PROTECTED]> wrote: > http://www.faqts.com/knowledge_base/view.phtml/aid/16824 There is a factual mistake on that reference. The last sentence > One final note: the single most common use for classmethod is probably > in overriding __new__(). It is alway

Weekly Python Patch/Bug Summary

2007-01-26 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 421 open ( -2) / 3549 closed (+10) / 3970 total ( +8) Bugs: 943 open (-17) / 6471 closed (+25) / 7414 total ( +8) RFE : 260 open ( +2) / 250 closed ( +1) / 510 total ( +3) New / Reopened Patches __ rlcomplet

Re: instancemethod

2007-01-26 Thread Gabriel Genellina
"Steven D'Aprano" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > On Fri, 26 Jan 2007 17:25:37 +0100, Bruno Desthuilliers wrote: >>>def __del__(self): >>>try: >>>self.close() >>>finally: >>>pass >>>except: >>>pas

Re: Resizing widgets in text windows

2007-01-26 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi, I've been searching for a .resize()-like function to overload much > like can be done for the delete window protocol as follows: > > toplevel.protocol("WM_DELETE_WINDOW", callback) > > I realize that the pack manager usually handles all of the resize > stuff, but I'

Re: Calling python function from C and import questions

2007-01-26 Thread Gabriel Genellina
<[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Is there a better way to make a call from C than > > PyRun_SimpleString("import > foo_in_python\nfoo_in_python.bar(whatever)\n"); > > I already imported the foo_in_python using PyImport_ImportModule > and wonder why do I need to

Re: Problem embedding the Python interpreter and importing win32extensions

2007-01-26 Thread Gabriel Genellina
<[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I am using python 2.2.3, because I am using some dSpace software > (controldesk/automationdesk) that is based upon that version of python. I > have some pre-compiled python modules that come with the dspace > applications. I am p

Re: Getting the output from a console command while it's been generated!

2007-01-26 Thread Gabriel Genellina
"Raúl Gómez C." <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I'm trying to make my apps more informative to the user, so I want to know > if its possible to get the output of the execution of a console command > while it's been generated, I mean, I want to get the output fr

Getting the output from a console command while it's been generated!

2007-01-26 Thread Raúl Gómez C.
Hi everyone, I'm trying to make my apps more informative to the user, so I want to know if its possible to get the output of the execution of a console command while it's been generated, I mean, I want to get the output from commands.getstatusoutput('CMD') while CMD it's been executed and not wai

dict.keys() ?

2007-01-26 Thread bearophileHUGS
The PEP 3100: http://www.python.org/dev/peps/pep-3100/ says: Return iterators instead of lists where appropriate for atomic type methods (e.g. dict.keys(), dict.values(), dict.items(), etc.); iter* methods will be removed. Better: make keys(), etc. return views ala Java collections??? ... To be re

help with subscription to a process

2007-01-26 Thread elrondrules
Hi I am new to python and hence need some help i have a process A that posts events as XML docs. I need to create a listener to this process that subscribes to the process A and as and when a XML doc is posted parse it. I have creted an interface where if I specify the port number on which the li

Re: how to remove c++ comments from a cpp file?

2007-01-26 Thread Gabriel Genellina
"Peter Otten" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Laurent Rahuel wrote: > >> And using the codecs module > > Why would you de/encode at all? I'd say the otherwise: why not? This is the recommended practice: decode inputs as soon as possible, work on Unicode, encod

Re: Off-Topic Posts

2007-01-26 Thread thermate2
Here is the supporting evidence about these contemptible spook bastards commiting heinous crimes using official positions. Just minutes ago hot from the internet press: http://www.nytimes.com/2007/01/26/washington/26nsa.html?ei=5094&en=9044950dc6386d92&hp=&ex=1169874000&partner=homepage&pagewanted

Re: Off-Topic Posts

2007-01-26 Thread thermate2
Hey spook, you trying to be clever. All my contempt is directed at you. Your attempts to drag in "Mr. Klien" as you typed it are rather failing and contemptible. We posted a general warning that other "conquered races or nationalities" who are never really treated equally by the anglo-saxon race st

Re: Unicode error handler

2007-01-26 Thread Rares Vernica
It does the job. Thanks a lot, Ray Peter Otten wrote: > Rares Vernica wrote: > >> Is there an encode/decode error handler that can replace all the >> not-ascii letters from iso-8859-1 with their closest ascii letter? > > A mapping, not an error handler, but it might do the job: > > http://effb

Re: assertions to validate function parameters

2007-01-26 Thread Steven D'Aprano
On Fri, 26 Jan 2007 18:28:32 +, Matthew Woodcraft wrote: > I have a question for you. Consider this function: > > def f(n): > """Return the largest natural power of 2 which does not exceed n.""" > if n < 1: > raise ValueError > i = 1 > while i <= n: > j = i >

Re: instancemethod

2007-01-26 Thread Steven D'Aprano
On Fri, 26 Jan 2007 17:25:37 +0100, Bruno Desthuilliers wrote: >>def __del__(self): >>try: >>self.close() >>finally: >>pass >>except: >>pass > > The finally clause is useless here. In principle, closing a file could raise an except

Re: Off-Topic Posts

2007-01-26 Thread Carl J. Van Arsdall
Yea, that guy sucks. Is there a list mod who can just ban this guy? Sean Schertell wrote: > Hey Genius -- I'm probably further to the left and even more > vehemently opposed to the Bush/Cheney regime than you are. But could > you *please* take your unwelcome ranting elsewhere? You're not >

Re: python+ncurses: I can't display accents

2007-01-26 Thread Thomas Dickey
Neil Cerutti <[EMAIL PROTECTED]> wrote: > I don't really expect it to work, but if anything will, that is > it. Curses supports only ASCII and a some special symbol codes > defined by curses. un - no. Curses supports whatever the flavor of curses you have does. Often that's the 8-bit flavor of n

Re: Off-Topic Posts

2007-01-26 Thread Sean Schertell
Hey Genius -- I'm probably further to the left and even more vehemently opposed to the Bush/Cheney regime than you are. But could you *please* take your unwelcome ranting elsewhere? You're not winning any converts here. And you're alienating your ideological allies to boot. Give it a rest,

Re: [ANN] markup.py 1.6 (bugfix: 1.6.1)

2007-01-26 Thread Daniel Nogradi
> The new 1.6 release of markup.py is available for download: > > http://sourceforge.net/project/showfiles.php?group_id=161108 > > What is it? > > Markup.py is an intuitive, lightweight, easy-to-use, customizable and > pythonic HTML/XML generator. > > Where is the documentation? > > http://markup.s

Re: Off-Topic Posts

2007-01-26 Thread thermate
What did Dick Faced Cheney told Honorable Senator Patrick Leahy ? "Fuck yourself". So much for politeness and vulgarity at the top level. Proof: http://www.capitolhillblue.com/news2/2007/01/the_madness_of.html On Jan 26, 2:53 pm, [EMAIL PROTECTED] wrote: > Yeah, listen to wise counsel of klein. A

Re: Off-Topic Posts

2007-01-26 Thread thermate
Yeah, listen to wise counsel of klein. As a member of conquered races and still under occupation, namely Jewish, French, German, Japanese, Korean ... dont mess in the crimes of the anglo-saxon yanks. You should remember the beating you got from the Anglo-Saxon Yanks and just keep quiet ... As for t

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 10:46 am, Robert Kern <[EMAIL PROTECTED]> wrote: > Yes, one can make numpy arrays with "object" as its type. One can even extend > the C-level parts as well. For example, we have an experimental package in the > scipy sandbox for uniform time series that uses mx.DateTime. > > http://www

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 10:18 am, Bob Greschke wrote: > You're using the Python-MySQL module mysqldb, right? Actually I using MySQL with pyodbc as the mysqldb Windows binaries for Python 2.5 aren't out yet. :-( > You can select the data from the database and have > MySQL do the conversion with an SQL command

Re: python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
> What happens when you try this? > stdscr.addstr(0,0, u"leçon".encode('iso8859-15')) > I don't really expect it to work And it doesn't... As support for 8-bit (and even unicode) is important for my script, is there any hope? Should I switch to slang instead of curses? -- Fabrice DELENTE --

Re: Yank Bastards KILLED THEIR OWN PEOPLE to stage 911 DRAMA

2007-01-26 Thread thermate
http://www.cbsnews.com/stories/2007/01/24/tech/main2395958.shtml Military Develops Non-Lethal Ray Gun TO ENSLAVE THE SHEEPLE New Weapon Makes Human Targets Feel Like They're About To Catch Fire MOODY AIR FORCE BASE, Ga., Jan. 24, 2007 Airmen pretending to be rioters scatter after being zapped by

Resizing widgets in text windows

2007-01-26 Thread deacon . sweeney
Hi, I've been searching for a .resize()-like function to overload much like can be done for the delete window protocol as follows: toplevel.protocol("WM_DELETE_WINDOW", callback) I realize that the pack manager usually handles all of the resize stuff, but I've found an arrangement that the pack m

Re: xml.dom.minidom.parseString segmentation fault on mod_python

2007-01-26 Thread Graham Dumpleton
On Jan 26, 10:00 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > On Jan 26, 10:41 am, [EMAIL PROTECTED] wrote: > > > Python 2.4.4 > >mod_python3.2.10 + Apache 2.0 > > > def index( req, **params ): > > from xml.dom.minidom import parseString > > doc = parseString( "whatever" ) > > > =>

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
On 2007-01-26, Fabrice DELENTE <[EMAIL PROTECTED]> wrote: >> What have you tried? > > I've tried > > stdscr.addstr(0,0,"aéïoù") > > or > > stdscr.addstr(0,0,"leçon") > > The ASCII chars show correctly, but the accented characters > don't, so I see 'ao' or 'leon' on the screen. > > The term in which

Calling python function from C and import questions

2007-01-26 Thread sndive
Is there a better way to make a call from C than PyRun_SimpleString("import foo_in_python\nfoo_in_python.bar(whatever)\n"); ? I already imported the foo_in_python using PyImport_ImportModule and wonder why do I need to keep importing it every time I'm calling a python function in that module. I

Re: Unicode error handler

2007-01-26 Thread Robert Kern
Rares Vernica wrote: > Is there an encode/decode error handler that can replace all the > not-ascii letters from iso-8859-1 with their closest ascii letter? No, but IBM's ICU library can transform one script to another in very flexible and capable ways. One such configuration can do what you ask.

Re: Unicode error handler

2007-01-26 Thread Peter Otten
Rares Vernica wrote: > Is there an encode/decode error handler that can replace all the > not-ascii letters from iso-8859-1 with their closest ascii letter? A mapping, not an error handler, but it might do the job: http://effbot.org/zone/unicode-convert.htm Peter -- http://mail.python.org/mail

Unicode error handler

2007-01-26 Thread Rares Vernica
Hi, Does anyone know of any Unicode encode/decode error handler that does a better replace job than the default replace error handler? For example I have an iso-8859-1 string that has an 'e' with an accent (you know, the French 'e's). When I use s.encode('ascii', 'replace') the 'e' will be rep

Editor with visual SCC / TFS support ?

2007-01-26 Thread Matt
Company has switched to MS Team Foundation Server from VSS. Need a programmers text editor that interfaces with TFS or SCC providers to visually provide checkin/out status on project files. So far, in all of the editors I have used, some support SCC interfaces, but do not show the file status. The

Re: A note on heapq module

2007-01-26 Thread bearophileHUGS
bearophile: > I don't like your solution, this class was already slow enough. Don't > use unbound methods with this class :-) Sorry for raising this discussion after so much time. Another possibile solution is to use the normal methods for the normal case, and replace them only if key is present (

Problem embedding the Python interpreter and importing win32 extensions

2007-01-26 Thread paroutyj
I have been playing around with this issue for a while and seen some previous posting trying to address the problem but I haven't seen any answers to the problem so I am reposting it in my quest for a solution. I am using python 2.2.3, because I am using some dSpace software (controldesk/autom

Re: python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
> What have you tried? I've tried stdscr.addstr(0,0,"aéïoù") or stdscr.addstr(0,0,"leçon") The ASCII chars show correctly, but the accented characters don't, so I see 'ao' or 'leon' on the screen. The term in which I display is 8-bit-able, so the problem is either on ncurses side, or on pytho

Re: Help extracting info from HTML source ..

2007-01-26 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, "Miki" <[EMAIL PROTECTED]> wrote: > Hello Shelton, > > > I am learning Python, and have never worked with HTML. However, I would > > like to write a simple script to audit my 100+ Netware servers via their web > > portal. > Always use the right tool, Beautilful

Re: python+ncurses: I can't display accents

2007-01-26 Thread Neil Cerutti
On 2007-01-26, Fabrice DELENTE <[EMAIL PROTECTED]> wrote: > I'm trying to display french characters (è -- that's e grave -- > or à -- agrave) in python 2.5, with the ncurses wrapper that > comes it, and I can't. My locale is set correctly > (fr_FR.iso885915), and my terminal (rxvt-unicode) is able

Yank Bastards KILLED THEIR OWN PEOPLE to stage 911 DRAMA

2007-01-26 Thread thermate
There is a million dollar reward for ANY fascist bastard to disprove this assertion by giving a consistent theory of ALL the major observed effects on that day about the related events. Dick faced Cheney sprayed his own lawyer with BB's. See the video by Alex Jones on the Forensics, why the claim

Re: Handling empty form fields in CGI

2007-01-26 Thread Paul Boddie
Christopher Mocock wrote: > > Bit of a python newbie so need a little help with a CGI script I'm > trying to write. I've got it working fine as long as the fields of the > form are filled in correctly, however I need to be able to accept blank > entries. Therefore I want to convert any empty entrie

Re: time series data and NumPy

2007-01-26 Thread Robert Kern
Diez B. Roggisch wrote: > I'm pretty sure you're out of luck here - even _if_ NumPy would handle > arbitrary data-types (AFAIK it doesn't, but then I'm not a total expert > there), it certainly won't be able to make its hi-performance functions > work on them. Yes, one can make numpy arrays with

Re: assertions to validate function parameters

2007-01-26 Thread Matthew Woodcraft
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > The less your function does, the more constrained it is, the less > testing you have to do -- but the less useful it is, and the more work > you put onto the users of your function. Instead of saying something > like > a = MyNumericClass(1) > b = MyNum

Re: Mounting shares with python

2007-01-26 Thread Bjoern Schliessmann
Marcpp wrote: > Hi, when i mount a share with python... > > os.system ("mount -t smbfs -o username=nobody ...") > > the problem is that I'll to be root. Consider modifying /etc/fstab. > Have a comand to send a root password...? > I've tried > > os.system ("su") > os.system ("the password") >

Re: Fixed length lists from .split()?

2007-01-26 Thread Bob Greschke
On 2007-01-26 11:13:56 -0700, Duncan Booth <[EMAIL PROTECTED]> said: > Bob Greschke <[EMAIL PROTECTED]> wrote: > >> Is there a fancy way to get Parts=Line.split(";") to make Parts always >> have three items in it, or do I just have to check the length of Parts >> and loop to add the required mi

Re: The reliability of python threads

2007-01-26 Thread Carl J. Van Arsdall
Hendrik van Rooyen wrote: > "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > > >> [snip] >> > > Are you 100% rock bottom gold plated guaranteed sure that there is > not something else that is also critical that you just haven't realised is? > 100%? No, definitely not. I know myself,

Re: Mounting shares with python

2007-01-26 Thread Carl J. Van Arsdall
Marcpp wrote: > Hi, when i mount a share with python... > > os.system ("mount -t smbfs -o username=nobody ...") > > the problem is that I'll to be root. > Have a comand to send a root password...? > I've tried > > os.system ("su") > os.system ("the password") > > but it doesn't works. > > I do a

Re: Handling empty form fields in CGI

2007-01-26 Thread Peter Otten
Christopher Mocock wrote: > Bit of a python newbie so need a little help with a CGI script I'm > trying to write. I've got it working fine as long as the fields of the > form are filled in correctly, however I need to be able to accept blank > entries. Therefore I want to convert any empty entries

Re: time series data and NumPy

2007-01-26 Thread Bob Greschke
On 2007-01-26 10:54:02 -0700, "BBands" <[EMAIL PROTECTED]> said: > On Jan 26, 9:29 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> What you could do would be to convert the date-column into a timestamp, >> which is a int/long, and use that. Would that help? > > Actually that might help, a

Re: Fixed length lists from .split()?

2007-01-26 Thread Duncan Booth
Bob Greschke <[EMAIL PROTECTED]> wrote: > Is there a fancy way to get Parts=Line.split(";") to make Parts always > have three items in it, or do I just have to check the length of Parts > and loop to add the required missing items (this one would just take > Parts+=[""], but there are other typ

Fixed length lists from .split()?

2007-01-26 Thread Bob Greschke
I'm reading a file that has lines like bcsn; 100; 1223 bcsn; 101; 1456 bcsn; 103 bcsn; 110; 4567 The problem is the line with only the one semi-colon. Is there a fancy way to get Parts=Line.split(";") to make Parts always have three items in it, or do I just have

Re: time series data and NumPy

2007-01-26 Thread BBands
On Jan 26, 9:29 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > What you could do would be to convert the date-column into a timestamp, > which is a int/long, and use that. Would that help? Actually that might help, as all I need the date for is to index values. Thanks, I'll give it a spin.

Re: how to remove c++ comments from a cpp file?

2007-01-26 Thread Paul McGuire
On Jan 26, 3:54 am, "Frank Potter" <[EMAIL PROTECTED]> wrote: > > I'm very sorry because I was in a hurry when I post this thread. > I'll post again my code here: > [CODE] > import re > > f=open("show_btchina.user.js","r").read() > f=unicode(f,"utf8") > > r=re.compile(ur"//[^\r\n]+$", re.UNICODE|re

Handling empty form fields in CGI

2007-01-26 Thread Christopher Mocock
Hi all, Bit of a python newbie so need a little help with a CGI script I'm trying to write. I've got it working fine as long as the fields of the form are filled in correctly, however I need to be able to accept blank entries. Therefore I want to convert any empty entries to an empty string. For

Re: Pyparsing - Dealing with a Blank Value

2007-01-26 Thread Steve
Hi Paul! Thanks for your suggestions on the default value (I didn't know you could do that!!) and the use of the makeHTMLtags module! Steve On Jan 25, 8:07 pm, "Paul McGuire" <[EMAIL PROTECTED]> wrote: > On Jan 25, 7:13 pm, "Steve" <[EMAIL PROTECTED]> wrote: > > > Hi All, > > > I've picked up th

Re: Thoughts on using isinstance

2007-01-26 Thread Terry Hancock
Bruno Desthuilliers wrote: > abcd a écrit : > >>Well my example function was simply taking a string and printing, but >>most of my cases would be expecting a list, dictionary or some other >>custom object. Still propose not to validate the type of data being >>passed in? > > > Yes - unless you

Re: time series data and NumPy

2007-01-26 Thread Diez B. Roggisch
BBands wrote: > Good morning, > > I store time series data in a SQL database. The results of a typical > query using pyodbc look like this. > > DateClose > "2007-01-17" 22.57 > > Where Date is a datetime.date object and Close is a float. > > I'd like to put this data in a NumPy arr

Re: instancemethod

2007-01-26 Thread Gert Cuykens
> class Obj(object): >pass > > toto = tutu = tata = titi = Obj() > > What's an "instance name" ? > > -- > http://mail.python.org/mailman/listinfo/python-list i would say __object__.__name__[3] == toto And if your obj is a argument like something(Obj()) i would say __object__.__name__[0] ==

Re: How can i do this in Python?

2007-01-26 Thread Gabriel Genellina
<[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I'm just curious, what's the advantage of using itemgetter there > compared to something simpler like this (untested!)? None! -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

python+ncurses: I can't display accents

2007-01-26 Thread Fabrice DELENTE
Hello. I'm trying to display french characters (è -- that's e grave -- or à -- agrave) in python 2.5, with the ncurses wrapper that comes it, and I can't. My locale is set correctly (fr_FR.iso885915), and my terminal (rxvt-unicode) is able to display those chars. What am I missing? Thanks. --

Re: DOS, UNIX and tabs

2007-01-26 Thread Steve Holden
Tim Roberts wrote: > "Ben" <[EMAIL PROTECTED]> wrote: >> Great - that worked.Thanks! >> Is that a general method in linux you can always use to redirect >> standard output to a file? > > Works in Windows, too. For some value of "work" :) regards Steve -- Steve Holden +44 150 684 7255 +

time series data and NumPy

2007-01-26 Thread BBands
Good morning, I store time series data in a SQL database. The results of a typical query using pyodbc look like this. DateClose "2007-01-17" 22.57 Where Date is a datetime.date object and Close is a float. I'd like to put this data in a NumPy array for processing, but am unsure as t

Re: Are there sprintf in Python???

2007-01-26 Thread Facundo Batista
questions? wrote: > Are there similar function to sprintf in C? Meaning to print in a buffer? It's not necessary... Remember that all the ways that prints on files, actually does not need to print into *actual* files, but they can print into file-like objects (see StringIO, or mmap, for example

Re: newbie - returned values from cscript.exe

2007-01-26 Thread ina
I did the same thing back before I knew about python and com. I hope this example gets you on the right track. It is just a simple script that does a dir and returns prints it out. import os, sys dCall = "dir" resultFromCall = os.popen(dCall) #get data back from the system call mv = resultFromCal

Activepython gcc and swig

2007-01-26 Thread stumblecrab
Hello, I've looked at the swig example in the back of "programming python" (Lutz). Using gcc to compile a swig wrapper I'm getting lots of errors. Instead of using the cygwin python, I'm trying to point swig to my activepython installation. I'm doing this because my modules are all win32 install

Re: instancemethod

2007-01-26 Thread Bruno Desthuilliers
Gert Cuykens a écrit : > import MySQLdb > > class Db(object): > >def __enter__(self): >pass > >def __init__(self,server,user,password,database): >self._db=MySQLdb.connect(server , user , password , database) >self._db.autocommit(True) >self.cursor=self._db

Re: Right-Justifying Numeric Output

2007-01-26 Thread Facundo Batista
Rich Shepard wrote: > print '%2d $%11.2f $%10.2f $%9.2f $%9.2f' %(nper, pv, diff, ten, bonus) > > and I would like to have the output right justified in the specified field. >>> "%7.2f..%5d" % (2.3, 78) ' 2.30.. 78' >>> "%-7.2f..%-5d" % (2.3, 78) '2.30 ..78 ' Regards, -- . Fa

Re: loose methods: Smalltalk asPython

2007-01-26 Thread Steve Holden
Carl Banks wrote: > Jan Theodore Galkowski wrote: >>> We've not had >>> an excellent dynamic OO language since Smalltalk, IMO. > > I would say that "excellence" in object oriented programming is not a > strong design goal of Python. Python tries to support OOP well, but > not to enhance OOP to th

Python for amd64 and x86 on Windows

2007-01-26 Thread Hengel, Simon
Hello List, I need the amd64 and the x86 version of Python installed on one Windows machine. Is there a way to do this? (I think I read about it somewhere, but now I can't find it anymore) Cheers, Simon Hengel Siemens AG Medical Solutions CO CHS CS 2 Mozartstr. 57 91052 Erlangen, Germany Tel.:

memory leak

2007-01-26 Thread john g
i have a memory leak issue with extension function that im working on. it reads data from a binary file into a stl vector then creates a new list to pass back to the python interface. the function works the first 1021 times but then gives a segmentation fault (core dumped). heres the business part

Re: Win XP "Sleep" mode: can Py wake up?

2007-01-26 Thread Chris Mellon
On 1/26/07, Bell, Kevin <[EMAIL PROTECTED]> wrote: > Does anyone have any experience having python deal with sleep mode? I'd > love to run something that would hear a sleep event coming and pickle > some data before sleep, then after coming out of sleep, unpickle... > > Any thoughts? > The whole

Re: how to remove c++ comments from a cpp file?

2007-01-26 Thread Peter Otten
Laurent Rahuel wrote: > And using the codecs module Why would you de/encode at all? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: how to remove c++ comments from a cpp file?

2007-01-26 Thread Laurent Rahuel
And using the codecs module [CODE] import codecs f = codecs.open("show_btchina.user.js","r","utf-8") modf = codecs.open("modified.js","w","utf-8") for line in f: idx = line.find(u"//") if idx==0: continue elif idx>0: line = line[:idx]+u'\n' modf.write(line) m

Re: Thoughts on using isinstance

2007-01-26 Thread Bruno Desthuilliers
Matthew Woodcraft a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> Matthew Woodcraft a écrit : > >>> Adding the validation code can make your code more readable, in that >>> it can be clearer to the readers what kind of values are being >>> handled. > >> This is better expressed in

Re: Win XP "Sleep" mode: can Py wake up?

2007-01-26 Thread Tim Golden
> Does anyone have any experience having python deal with sleep mode? I'd > love to run something that would hear a sleep event coming and pickle > some data before sleep, then after coming out of sleep, unpickle... It should, in theory, be possibly by trapping the WMI Win32_PowerManagementEvent

Win XP "Sleep" mode: can Py wake up?

2007-01-26 Thread Bell, Kevin
Does anyone have any experience having python deal with sleep mode? I'd love to run something that would hear a sleep event coming and pickle some data before sleep, then after coming out of sleep, unpickle... Any thoughts? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to unistall a Python package?

2007-01-26 Thread Thomas Heller
Colin J. Williams schrieb: > With Windows, a few packages, eg. PythonWin, also modify the registry. > numpy, the elaboration of numarray/numeric, and PythonWin have > RemoveXXX.exe in C:\Python25. > > I don't know whether this is the standard approach. There doesn't seem > to be a reference to

Re: Help extracting info from HTML source ..

2007-01-26 Thread Miki
Hello Shelton, > I am learning Python, and have never worked with HTML. However, I would > like to write a simple script to audit my 100+ Netware servers via their web > portal. Always use the right tool, BeautilfulSoup (http://www.crummy.com/software/BeautifulSoup/) is best for web scraping (I

Re: stop script w/o exiting interpreter

2007-01-26 Thread Colin J. Williams
Alan Isaac wrote: > I'm fairly new to Python and I've lately been running a script at > the interpreter while working on it. Sometimes I only want to > run the first quarter or half etc. What is the "good" way to do this? > > Possible ugly hacks include: > > - stick an undefined name at the des

Re: Mounting shares with python

2007-01-26 Thread Michael Bentley
On Jan 26, 2007, at 6:40 AM, Marcpp wrote: > Hi, when i mount a share with python... > > os.system ("mount -t smbfs -o username=nobody ...") > > the problem is that I'll to be root. > Have a comand to send a root password...? > I've tried > > os.system ("su") > os.system ("the password") > > but

Re: Mounting shares with python

2007-01-26 Thread Diez B. Roggisch
Marcpp wrote: > Hi, when i mount a share with python... > > os.system ("mount -t smbfs -o username=nobody ...") > > the problem is that I'll to be root. > Have a comand to send a root password...? > I've tried > > os.system ("su") > os.system ("the password") > > but it doesn't works. You can

Mounting shares with python

2007-01-26 Thread Marcpp
Hi, when i mount a share with python... os.system ("mount -t smbfs -o username=nobody ...") the problem is that I'll to be root. Have a comand to send a root password...? I've tried os.system ("su") os.system ("the password") but it doesn't works. -- http://mail.python.org/mailman/listinfo/py

  1   2   >