Re: GeneratorExit should derive from BaseException, not Exception

2007-08-21 Thread Chad Austin
Hi Terry, Thank you for your feedback. Responses inline: Terry Reedy wrote: > "Chad Austin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > || try: > | result = yield chatGateway.checkForInvite({'userId': userId}) > | logger.info('checkForInvite2 returned %s', result) > > would

Re: GeneratorExit should derive from BaseException, not Exception

2007-08-21 Thread Chad Austin
Oops, forgot to mention this: I wouldn't be opposed to a different extension that would effectively let me accomplish the same goals... arbitrary exception filters. Imagine this: try: raise GeneratorExit except ExceptionFilter: # blah where Exce

Re: Newbee Question

2007-08-21 Thread Asun Friere
Oh well since a few solutions have already been posted I thought I might add another, just so you at the very least you have to do some work making up your mind which one to choose. Using an incremental approach just to be different ... from decimal import Decimal normal = Decimal('0.04') over =

Re: Is there a way to change the default string encoding?

2007-08-21 Thread Fabio Z Tessitore
Il Mon, 20 Aug 2007 18:44:39 -0700, Ron Garret ha scritto: > Is there a way to change the default string encoding ... Dive Into Python. Section 9 on http://diveintopython.org/xml_processing/ unicode.html That will help. Bye Fabio -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to change the default string encoding?

2007-08-21 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Peter Otten <[EMAIL PROTECTED]> wrote: > If all else fails there's > > >>> sys.setdefaultencoding("latin1") > >>> "Andre\xe9 Ramel".decode() > u'Andre\xe9 Ramel' > > but that's an evil hack, you should rather talk to the maintainer of the > offending code to upda

Re: Newbee Question

2007-08-21 Thread Asun Friere
On Aug 21, 5:41 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > over = Decimal('1.40) oops, that should of course be: over = Decimal('1.40') -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to change the default string encoding?

2007-08-21 Thread Peter Otten
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > Peter Otten <[EMAIL PROTECTED]> wrote: > >> If all else fails there's >> >> >>> sys.setdefaultencoding("latin1") >> >>> "Andre\xe9 Ramel".decode() >> u'Andre\xe9 Ramel' >> >> but that's an evil hack, you should rather talk to the maintainer

Re: Newbee Question

2007-08-21 Thread Asun Friere
On Aug 21, 5:51 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > On Aug 21, 5:41 pm, Asun Friere <[EMAIL PROTECTED]> wrote:> over = > Decimal('1.40) > > oops, that should of course be: > over = Decimal('1.40') oh boy ... and it should also be normal = Decimal('0.40') I really need to test before pos

Re: wxPython before MainLoop

2007-08-21 Thread [david]
Thanks for that suggestion, and sorry I took so long to get back to you. That worked. Because I don't want the splash screen, just self.Update regards, [david] Heikki Toivonen wrote: > [david] wrote: >> I'd like to refresh the display before I start the main loop. > > We have this kind

Re: File Read Cache - How to purge?

2007-08-21 Thread Marc 'BlackJack' Rintsch
On Mon, 20 Aug 2007 21:06:43 -0700, Signal wrote: > 1. I don't quite understand how after one full read of a file, another > full read of the same file is "cached" so significantly while > consuming so little memory. What exactly is being cached to improve > the reading of the file a second time?

setproctitle

2007-08-21 Thread sadfub
Hi, is there still no possibility to easly set the process title? I found a third party addon here: http://mail.python.org/pipermail/python-list/2004-August/273115.html. Shouldn't "import posix" do the thing? I am using python 2.5. Since I write a python daemon here, I need to set the correct nam

Re: Ten years on....

2007-08-21 Thread Knikola
Clarence wrote: > I've been waiting for a month to post this (yesterday), and then I > missed it. Oh, well, it's funny and deserves to be republished on its > ten-year-and-one-day anniversary. > > BTW, a member of the ANSI C committee once told me that the only thing > rand is used for in C code i

Re: wxPython before MainLoop

2007-08-21 Thread [david]
> Looking at the Chandler code suggests a solution > ... he may need to call Update to finish painting > the display. Yes, and thank you to Chandler for pointing that out. Without the splash screen there was no need to call Yield or use a generator. (david) samwyse wrote: > Chris Mellon wro

searching dict key with reqex

2007-08-21 Thread james_027
hi, can I use regex instead of a plain string with this kind of syntax ... 'name' in a_dictionary something like r'name_\D+' in a_dictionary? Thanks james -- http://mail.python.org/mailman/listinfo/python-list

Re: Adjusting the names of custom exceptions (since raising strings is deprecated)

2007-08-21 Thread James Stroud
Silfheed wrote: > Heyas > > So this probably highlights my lack of understanding of how naming > works in python, but I'm currently using FailUnlessRaises in a unit > test and raising exceptions with a string exception. It's working > pretty well, except that I get the deprecation warning that ra

Regarding Classes

2007-08-21 Thread Lamonte Harris
What is the main reason of "self" when it involves classes/functions -- http://mail.python.org/mailman/listinfo/python-list

Re: I Need help from all the group participants

2007-08-21 Thread Shawn Milochik
"Please enter John's heart rate." "Please notify me immediately if John's heart rate drops below 60 or exceeds 100." -- http://mail.python.org/mailman/listinfo/python-list

Re: searching dict key with reqex

2007-08-21 Thread James Stroud
james_027 wrote: > hi, > > can I use regex instead of a plain string with this kind of syntax ... > > 'name' in a_dictionary > > something like > > r'name_\D+' in a_dictionary? > > Thanks > james > This makes it a one-liner: import re def rgxindict(rgx, adict): return any(re.match(rgx,k

Re: Newbee Question

2007-08-21 Thread Ant
On Aug 20, 11:47 pm, [EMAIL PROTECTED] wrote: ... > Thanks for the help. By the way I am trying to learn the python after > work and on weekends. If it was a dumb question, to this group, I will > not bother you all again. It's not so much that it was a dumb question, but that it was asked in a du

The folder a script is executed in

2007-08-21 Thread aine_canby
Hi, How do I find out what folder a script is in while it is executing? For example, for the file "C:/folder/script.py" contain the following two lines of code - myLocation = GetMyLocation() print myLocation >> C:/folder Thanks, Aine. -- http://mail.python.org/mailman/listinfo/python-list

how to remove number

2007-08-21 Thread susanti marsol
how to remove all number in our's document? [EMAIL PROTECTED] wrote: Send Python-list mailing list submissions to python-list@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/python-list or, via email, send a message with subject or b

Re: The folder a script is executed in

2007-08-21 Thread Ant
On Aug 21, 10:10 am, [EMAIL PROTECTED] wrote: ... > myLocation = GetMyLocation() > print myLocation > > >> C:/folder Do you mean the folder containing the script? Or the current working directory? If the former, then look at os.path.split(sys.argv[0])[0] If the latter, try something like: os.path

Re: File Read Cache - How to purge?

2007-08-21 Thread Signal
> What do you mean by so little memory. It (the whole file) is cached by the > operating system totally independent of your program. Please note I already stated it was more than likely by the OS and noted the tests to confirm that. > It (the whole file) is cached by the operating system totally

Re: The folder a script is executed in

2007-08-21 Thread aine_canby
On 21 Aug, 11:27, Ant <[EMAIL PROTECTED]> wrote: > On Aug 21, 10:10 am, [EMAIL PROTECTED] wrote: > ... > > > myLocation = GetMyLocation() > > print myLocation > > > >> C:/folder > > Do you mean the folder containing the script? Or the current working > directory? > > If the former, then look at os.

hi everybody

2007-08-21 Thread Beema shafreen
hi everybody, i have written to fetch the url, and accesstje nm and np entries my code: import re import urllib2 import time Gene_id=raw_input("Please enter the gene_id:") fh = urllib2.urlopen(' http://www.ncbi.nlm.nih.gov/sites/entrez?db=gene&cmd=search&term='+Gene_id) for line in fh.readlines():

Re: The folder a script is executed in

2007-08-21 Thread Ant
On Aug 21, 10:29 am, [EMAIL PROTECTED] wrote: > On 21 Aug, 11:27, Ant <[EMAIL PROTECTED]> wrote: > > > > > On Aug 21, 10:10 am, [EMAIL PROTECTED] wrote: > > ... > > > > myLocation = GetMyLocation() > > > print myLocation > > > > >> C:/folder > > > Do you mean the folder containing the script? Or th

Re: The folder a script is executed in

2007-08-21 Thread Bjoern Schliessmann
Ant wrote: > Do you mean the folder containing the script? Or the current > working directory? > > If the former, then look at os.path.split(sys.argv[0])[0] test.py: | #!/usr/bin/env python | import sys,os | print os.path.split(sys.argv[0])[0] $ cd tmp ~/tmp$ ../test.py .. ~/tmp$ That's rath

IDE for Python

2007-08-21 Thread Joel Andres Granados
Hello list: I have tried various times to use an IDE for python put have always been disapointed. I haven't revisited the idea in about a year and was wondering what the python people use. I have also found http://pida.co.uk/main as a possible solution. Anyone tried it yet? suggestions. Re

C# and Python

2007-08-21 Thread subeen
Hi, I am a newcomer in Python. I am going to write a small Python application that will run in windows xp. This application needs to have GUI. Is it possible to make a C# application using visual studio 2005 that will call the python scripts? Let me explain more here: My program will generate a te

Re: File Read Cache - How to purge?

2007-08-21 Thread Marc 'BlackJack' Rintsch
On Tue, 21 Aug 2007 02:29:14 -0700, Signal wrote: >> It (the whole file) is cached by the operating system totally independent >> of your program, so the memory used does of course not show up in the memory >> stats of your program... > > In this case the OS is Windows and monitoring the memory

Re: The folder a script is executed in

2007-08-21 Thread Ant
On Aug 21, 10:47 am, Bjoern Schliessmann wrote: > Ant wrote: ... > | print os.path.split(sys.argv[0])[0] > > $ cd tmp > ~/tmp$ ../test.py > .. > ~/tmp$ > > That's rather not what's intended. I'd try os.path.abspath(__file__) > instead. Fair point. On Win32 sys.argv[0] always seems to give the ful

Re: C# and Python

2007-08-21 Thread Tommy Nordgren
On 21 aug 2007, at 12.01, subeen wrote: > Hi, > I am a newcomer in Python. I am going to write a small Python > application that will run in windows xp. This application needs to > have GUI. Is it possible to make a C# application using visual studio > 2005 that will call the python scripts? Let

Re: IDE for Python

2007-08-21 Thread Thomas Wittek
Joel Andres Granados schrieb: > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. Did you try Eclipse + PyDev? I'm quite happy with that. -- Thomas Wittek Web: h

Re: IDE for Python

2007-08-21 Thread Bikal KC
Joel Andres Granados wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. > I have also found http://pida.co.uk/main as a possible solution.

Re: C# and Python

2007-08-21 Thread Gerard Flanagan
On Aug 21, 12:01 pm, subeen <[EMAIL PROTECTED]> wrote: > Hi, > I am a newcomer in Python. I am going to write a small Python > application that will run in windows xp. This application needs to > have GUI. Is it possible to make a C# application using visual studio > 2005 that will call the python

Re: C# and Python

2007-08-21 Thread Olexandr Melnyk
Aside from method mentioned by Tom, you can invoke your script through command line: C:\Python24\bin\python.exe file-to-sort.txt result-file.txt 2007/8/21, subeen <[EMAIL PROTECTED]>: > > Hi, > I am a newcomer in Python. I am going to write a small Python > application that will run in windows x

Re: C# and Python

2007-08-21 Thread Bikal KC
subeen wrote: > When the user clicks Quick Sort button, the quicksort.py will be > called and it will sort the numbers. One way to do this: In your C# app, have the mouse click event handler call python interpreter "/path/to/python /path/to/quicksort.py". Make quicksort.py write to a file the res

Re: Newbee Question

2007-08-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > > Thanks for the help. By the way I am trying to learn the python after > work and on weekends. If it was a dumb question, to this group, I will > not bother you all again. > Without help it will take me longer to learn. Thanks > Don't worry about it. There is als

Re: The folder a script is executed in

2007-08-21 Thread Bjoern Schliessmann
Ant wrote: > Fair point. On Win32 sys.argv[0] always seems to give the full > path rather than the relative path Strange. > - hadn't realised it was different for linux (?). Yes, I used GNU/Linux for the example. Regards, Björn -- BOFH excuse #148: Insert coin for new game -- http://ma

Re: Latest models of Gibson guitars

2007-08-21 Thread willshak
on 8/20/2007 5:51 PM Lew said the following: > RickH wrote: >> On Aug 19, 9:24 pm, Randall Ainsworth <[EMAIL PROTECTED]> >> wrote: >>> In article <[EMAIL PROTECTED]>, Hermit >>> >>> <[EMAIL PROTECTED]> wrote: How does the image quality compare with a DSLR? >>> Depends on whether it's a Paul or

Re: IDE for Python

2007-08-21 Thread king kikapu
On Aug 21, 12:00 pm, Joel Andres Granados <[EMAIL PROTECTED]> wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. I have also tried a lot of them (IDEs) in the last year. I was finally happy with Eclipse/Pydev but i was always wanted a

Re: C# and Python

2007-08-21 Thread Ant
On Aug 21, 11:01 am, subeen <[EMAIL PROTECTED]> wrote: > Hi, ... > But I want to write the GUI and number generation program in C#.net. > When the user clicks Quick Sort button, the quicksort.py will be > called and it will sort the numbers. Probably worth looking at IronPython, the Python impleme

Re: C# and Python

2007-08-21 Thread Bikal KC
>From Eric CHAO [accidently sent to me]: Maybe you could try IronPython. It's another implement in .NET platform. Not 100% compatible but for sorting, that's ok. I think it's a better way to use GUI that .NET provide. And if you download VS 2005 SDK, there is many demo projects about IronPython.

Re: Retrieving a variable's name.

2007-08-21 Thread rodrigo
You're right, Paul, Evan, James, I should just use a dictionary. Thanks! Rodrigo -- http://mail.python.org/mailman/listinfo/python-list

Module level descriptors or properties

2007-08-21 Thread Floris Bruynooghe
Hi When in a new-style class you can easily transform attributes into descriptors using the property() builtin. However there seems to be no way to achieve something similar on the module level, i.e. if there's a "version" attribute on the module, the only way to change that to some computation l

Re: Latest models of Gibson guitars

2007-08-21 Thread kaldrenon
On Aug 20, 8:54 pm, Twisted <[EMAIL PROTECTED]> wrote: > If the message then > says something absurd, like "this is a newsgroup about Python" when > I'm reading it in cljp, well, what do you expect? :P I think most would expect you to go, "WTF?" but then, like a rational person, click the helpful

Re: File Read Cache - How to purge?

2007-08-21 Thread Neil Hodgson
Signal: > So it seems the file is being cached, however on my system only ~2MB > of additional memory is used when the program is run. This 2MB of > memory is released when the script exits. You are not measuring the memory used by the cache. This may help: http://www.microsoft.com/technet/ar

Re: Python project solicitation

2007-08-21 Thread Greg Copeland
On Aug 20, 9:35 pm, JoeSox <[EMAIL PROTECTED]> wrote: > I must say this thing is pretty cool. I had a coworker try it out and > he ran into problems getting it to run on his Linux OS. So I am > really looking for some non-Windows developers to take a look at it. > All of the info is at the proje

Re: IDE for Python

2007-08-21 Thread Greg Copeland
On Aug 21, 5:00 am, Joel Andres Granados <[EMAIL PROTECTED]> wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. > I have also foundhttp://pi

Logging module gives duplicate log entries

2007-08-21 Thread Shiao
Hi, I am getting duplicate log entries with the logging module. The following behaves as expected, leading to one log entry for each logged event: logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log') But this results in two entries for each logged event: applog = logging.getLogger(

Re: C# and Python

2007-08-21 Thread Chris Mellon
On 8/21/07, Ant <[EMAIL PROTECTED]> wrote: > On Aug 21, 11:01 am, subeen <[EMAIL PROTECTED]> wrote: > > Hi, > ... > > But I want to write the GUI and number generation program in C#.net. > > When the user clicks Quick Sort button, the quicksort.py will be > > called and it will sort the numbers. >

Re: IDE for Python

2007-08-21 Thread Greg Copeland
On Aug 21, 5:00 am, Joel Andres Granados <[EMAIL PROTECTED]> wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. > I have also foundhttp://pi

Re: Logging module gives duplicate log entries

2007-08-21 Thread Amit Khemka
On 8/21/07, Shiao <[EMAIL PROTECTED]> wrote: > Hi, > I am getting duplicate log entries with the logging module. > > The following behaves as expected, leading to one log entry for each > logged event: > > logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log') > > But this results in two

3D plot of 50 lines kwing end points using VTK

2007-08-21 Thread yadin
does anyone know how to plot multimple lines like lets say... 50 lines each liine is defined beetween two given points using VTK. a litlle example will be ok please on python and VTK thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Module level descriptors or properties

2007-08-21 Thread Diez B. Roggisch
Floris Bruynooghe wrote: > Hi > > When in a new-style class you can easily transform attributes into > descriptors using the property() builtin. However there seems to be > no way to achieve something similar on the module level, i.e. if > there's a "version" attribute on the module, the only wa

Re: reading a line in file

2007-08-21 Thread Neil Cerutti
On 2007-08-20, Shawn Milochik <[EMAIL PROTECTED]> wrote: > Everybody hates regexes. Except me. Discrimination! I love them when I'm editing files with Vim, hate 'em when I'm analyzing files with Python code. So I'm a descriminate descriminator. -- Neil Cerutti The First World War, cause by the

Re: IDE for Python

2007-08-21 Thread limodou
On 8/21/07, king kikapu <[EMAIL PROTECTED]> wrote: > On Aug 21, 12:00 pm, Joel Andres Granados <[EMAIL PROTECTED]> > wrote: > > Hello list: > > > > I have tried various times to use an IDE for python put have always been > > disapointed. > > > I have also tried a lot of them (IDEs) in the last year

restoring the default completer in IPython

2007-08-21 Thread Michele Simionato
This should probably go to the IPython list, but since I am not subscribed I will try my luck here. Basically, I want to embed IPython inside a command line interpreter based on cmd.Cmd, in this way: import cmd, IPython class Cmd(cmd.Cmd): def do_ipython(self, arg): ipython = IPython.

Re: Python project solicitation

2007-08-21 Thread JoeSox
On 8/21/07, Greg Copeland <[EMAIL PROTECTED]> wrote: > > On Aug 20, 9:35 pm, JoeSox <[EMAIL PROTECTED]> wrote: > > I must say this thing is pretty cool. I had a coworker try it out and > > he ran into problems getting it to run on his Linux OS. So I am > > really looking for some non-Windows deve

python 2.5.1 segfault, multithreading & dual core issue?

2007-08-21 Thread Paul Sijben
I am running a multi-threaded python application in a dual core intel running Ubuntu. I am using python 2.5.1 that I compiled myself. At random points I am getting segmentation faults (sometimes indicating a duplicate free). Below is the backtrace of the latest segfault. I am thinking this might

Re: File Read Cache - How to purge?

2007-08-21 Thread Hrvoje Niksic
Signal <[EMAIL PROTECTED]> writes: > 2. Is there anyway to somehow to take advantage of this "caching" by > initializing it without reading through the entire file first? > > 3. If the answer to #2 is No, then is there a way to purge this > "cache" in order to get a more accurate result in my rout

Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"

2007-08-21 Thread epsilon
Hey gang! I'm having trouble with this script from a CGI lesson I'm working and I can't seem to figure it out. I was wondering if someone could tell me what is wrong. I've spent several hours trying to debug, but no success. Any help would be appreciated. Thank you, Christopher + Python

Re: python 2.5.1 segfault, multithreading & dual core issue?

2007-08-21 Thread Peter Otten
Paul Sijben wrote: > I am running a multi-threaded python application in a dual core intel > running Ubuntu. > > I am using python 2.5.1 that I compiled myself. At random points I am > getting segmentation faults (sometimes indicating a duplicate free). > Below is the backtrace of the latest segf

Re: Server-side scripting in python

2007-08-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Nagarajan <[EMAIL PROTECTED]> wrote: >Hi group, >I need to develop a web application. I am in a fix as to choose among >the various server-side scripting options. I want to explore python >(am a newbie) to gain expertise and upon search, I learnt about >PSP(Python S

Re: GeneratorExit should derive from BaseException, not Exception

2007-08-21 Thread Terry Reedy
| I've actually read the background on the exception hierarchy (and agree | with it all), especially other suggestions that GeneratorExit derive | from BaseException. As I understand it, Guido's objections are threefold: [snip] After waiting a day or so to see if you get any more feedback here

Python Path Dictionary

2007-08-21 Thread aine_canby
Hi, Do the Python Paths come in the form of a dictionary where I can access a particular path my its key in the registry? For example, in PythonWin Tools>>Edit Python Paths shows the name as well of the address of each path Thanks, Aine -- http://mail.python.org/mailman/listinfo/python-list

Re: Latest models of Gibson guitars

2007-08-21 Thread Twisted
On Aug 21, 8:52 am, kaldrenon <[EMAIL PROTECTED]> wrote: > On Aug 20, 8:54 pm, Twisted <[EMAIL PROTECTED]> wrote: > > > If the message then > > says something absurd, like "this is a newsgroup about Python" when > > I'm reading it in cljp, well, what do you expect? :P > > I think most would expect

Re: python 2.5.1 segfault, multithreading & dual core issue?

2007-08-21 Thread Hrvoje Niksic
Paul Sijben <[EMAIL PROTECTED]> writes: > I am running a multi-threaded python application in a dual core > intel running Ubuntu. [...] Judging from the stack trace, this patch has a good chance of fixing your problem: http://mail.python.org/pipermail/python-dev/2007-August/074232.html -- h

Re: IDE for Python

2007-08-21 Thread Benjamin
On Aug 21, 5:00 am, Joel Andres Granados <[EMAIL PROTECTED]> wrote: > Hello list: > > I have tried various times to use an IDE for python put have always been > disapointed. > I haven't revisited the idea in about a year and was wondering what the > python people > use. > I have also foundhttp://pi

Re: The folder a script is executed in

2007-08-21 Thread Benjamin
On Aug 21, 4:10 am, [EMAIL PROTECTED] wrote: > Hi, > > How do I find out what folder a script is in while it is executing? > > For example, for the file "C:/folder/script.py" contain the following > two lines of code - > > myLocation = GetMyLocation() > print myLocation def GetMyLocation(): run

Re: Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"

2007-08-21 Thread Gabriel Genellina
On 21 ago, 11:14, epsilon <[EMAIL PROTECTED]> wrote: > I'm having trouble with this script from a CGI lesson I'm working and > I can't seem to figure it out. I was wondering if someone could tell > me what is wrong. I've spent several hours trying to debug, but no > success. Any help would be a

Re: Python Path Dictionary

2007-08-21 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hi, > > Do the Python Paths come in the form of a dictionary where I can > access a particular path my its key in the registry? > > For example, in PythonWin Tools>>Edit Python Paths shows the name as > well of the address of each path > > Thanks, > > Aine > > If by "P

Manipulating raw data in Python

2007-08-21 Thread Looney, James B
How do I get access to a data buffer in Python so that I can directly view/modify the data? My buffer size is 256 (for this specific case) bytes. Most of the time, I access want to access that data in 4-byte chunks, sometimes in single byte chunks. How do I go about doing so? I'm certain someon

Re: File Read Cache - How to purge?

2007-08-21 Thread Wolfgang Draxinger
Marc 'BlackJack' Rintsch wrote: > You mean reading the file without actually reading it!? :-) Linux provides its specific syscall 'readahead' that does exactly this. Wolfgang Draxinger -- E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867 -- http://mail.python.org/mailman/listin

How to optimise this code?

2007-08-21 Thread David N Montgomery
class testCase: def __init__(self, tc): if tc == 1:self.testCase1() if tc == 2:self.testCase2() if tc == 3:self.testCase3() if tc == 4:self.testCase4() if tc == 5:self.testCase5() if tc == 6:self.testCase6() def testCase1(self): print

Python is removing my quotes!

2007-08-21 Thread Robert Dailey
Hi, Note: I'm using Python on Windows I have an application that allows a user to submit a password as a command line parameter. The password of choice may contain any characters the user wishes, including quotes. If I do the following: python password.py ""MyPassword The resulting output w

Re: I Need help from all the group participants

2007-08-21 Thread Aaron
"Boris Ozegovic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am working on some system, and the communication will take place through > the chatterbot which will be written in AIML (interpreter is written in > Python). English is not my mother tongue, so I need huge fa

Re: Python is removing my quotes!

2007-08-21 Thread Gary Herron
Robert Dailey wrote: > Hi, > > Note: I'm using Python on Windows > > I have an application that allows a user to submit a password as a > command line parameter. The password of choice may contain any > characters the user wishes, including quotes. If I do the following: > > python password.py "999

Re: Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"

2007-08-21 Thread epsilon
Gabriel, Thanks a bunch for your time! That took care of it. Christopher Gabriel Genellina wrote: > On 21 ago, 11:14, epsilon <[EMAIL PROTECTED]> wrote: > > > I'm having trouble with this script from a CGI lesson I'm working and > > I can't seem to figure it out. I was wondering if someone co

Re: The folder a script is executed in

2007-08-21 Thread kyosohma
On Aug 21, 10:23 am, Benjamin <[EMAIL PROTECTED]> wrote: > On Aug 21, 4:10 am, [EMAIL PROTECTED] wrote:> Hi, > > > How do I find out what folder a script is in while it is executing? > > > For example, for the file "C:/folder/script.py" contain the following > > two lines of code - > > > myLocation

Re: How to optimise this code?

2007-08-21 Thread kyosohma
On Aug 21, 10:59 am, "David N Montgomery" <[EMAIL PROTECTED]> wrote: > class testCase: > def __init__(self, tc): > if tc == 1:self.testCase1() > if tc == 2:self.testCase2() > if tc == 3:self.testCase3() > if tc == 4:self.testCase4() > if tc == 5:self.test

Re: How to optimise this code?

2007-08-21 Thread Peter Otten
David N Montgomery wrote: > class testCase: > def __init__(self, tc): > if tc == 1:self.testCase1() > if tc == 2:self.testCase2() > if tc == 3:self.testCase3() > if tc == 4:self.testCase4() > if tc == 5:self.testCase5() > if tc == 6:self.testCase

Re: Python is removing my quotes!

2007-08-21 Thread Robert Dailey
Thank you for your response. The back slashes work! It's a bit annoying; but I have Microsoft to thank for that. On 8/21/07, Gary Herron <[EMAIL PROTECTED]> wrote: > > Robert Dailey wrote: > > Hi, > > > > Note: I'm using Python on Windows > > > > I have an application that allows a user to submit

Re: How to optimise this code?

2007-08-21 Thread J. Cliff Dyer
David N Montgomery wrote: > class testCase: > def __init__(self, tc): > if tc == 1:self.testCase1() > if tc == 2:self.testCase2() > if tc == 3:self.testCase3() > if tc == 4:self.testCase4() > if tc == 5:self.testCase5() > if tc == 6:self.testCase6

Re: File Read Cache - How to purge?

2007-08-21 Thread Nick Craig-Wood
Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Signal <[EMAIL PROTECTED]> writes: > > > 2. Is there anyway to somehow to take advantage of this "caching" by > > initializing it without reading through the entire file first? > > > > 3. If the answer to #2 is No, then is there a way to purge this > > "

Re: I Need help from all the group participants

2007-08-21 Thread Boris Ozegovic
Aaron wrote: [...] > Good luck. Thanks a lot for your help. -- Ne dajte da nas lažljivac Bandić truje: http://cnn.blog.hr/arhiva-2007-06.html#1622776372 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to optimise this code?

2007-08-21 Thread Dustan
On Aug 21, 11:20 am, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > I suspect lambda might be your friend here too for making the code less > verbose, though I never really got the hang of lambdas, even though my > first programming experience was a scheme class way back when Ah well. That's be

Re: yet another indentation proposal

2007-08-21 Thread [EMAIL PROTECTED]
On Aug 18, 2:22 pm, "Aaron" <[EMAIL PROTECTED]> wrote: > Hello all. > > I realize that proposals dealing with alternatives to indentation have been > brought up (and shot down) before, but I would like to take another stab at > it, because it is rather important to me. > > I am totally blind, and

Re: Newbee Question

2007-08-21 Thread [EMAIL PROTECTED]
On Aug 21, 4:38 am, Ant <[EMAIL PROTECTED]> wrote: > On Aug 20, 11:47 pm, [EMAIL PROTECTED] wrote: > ... > > > Thanks for the help. By the way I am trying to learn the python after > > work and on weekends. If it was a dumb question, to this group, I will > > not bother you all again. > > It's not

Re: str().join() isn't working

2007-08-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Aug 20, 1:16 pm, "Robert Dailey" <[EMAIL PROTECTED]> wrote: [...] > When you use join, you join the items in the list with each other to > form one long string. In your statement, your script tries to > concatenate 2 lists to each other before it does the join, which i

Re: Retrieving a variable's name.

2007-08-21 Thread Steve Holden
rodrigo wrote: > How would I go about retrieving a variable's name (not its value)? I > want to write a function that, given a list of variables, returns a > string with each variable's name and its value, like: > > a: 100 > b: 200 > > I get the feeling this is trivial, but I have been unable to

Re: str().join() isn't working

2007-08-21 Thread kyosohma
On Aug 20, 8:18 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > On Aug 21, 4:34 am, [EMAIL PROTECTED] wrote: > > > to concatenate 2 lists to each other before it does the join, ... is > > impossible in Python. The "+" operator is only for addition and for > > two or more strings. > > Really? > > >>> [

Re: Newbee Question

2007-08-21 Thread sentientholon
On Aug 21, 11:52 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I tryed your code and got an error message #I use Wing IDE: > Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] > Type "help", "copyright", "credits" or "license" for more information. > > Evaluating lines 1-16 from

Re: Retrieving a variable's name.

2007-08-21 Thread Simon Brunning
On 8/21/07, rodrigo <[EMAIL PROTECTED]> wrote: > How would I go about retrieving a variable's name (not its value)? http://effbot.org/pyfaq/how-can-my-code-discover-the-name-of-an-object.htm -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ GTalk: simon.brunning | M

Re: Module level descriptors or properties

2007-08-21 Thread Steven Bethard
Floris Bruynooghe wrote: > When in a new-style class you can easily transform attributes into > descriptors using the property() builtin. However there seems to be > no way to achieve something similar on the module level, i.e. if > there's a "version" attribute on the module, the only way to chan

Re: Manipulating raw data in Python

2007-08-21 Thread Chris Mellon
On 8/21/07, Looney, James B <[EMAIL PROTECTED]> wrote: > > > > How do I get access to a data buffer in Python so that I can directly > view/modify the data? My buffer size is 256 (for this specific case) bytes. > Most of the time, I access want to access that data in 4-byte chunks, > sometimes in

Submit Your Python Scripts

2007-08-21 Thread andrew . sain
Hi, just wanted to invite any Python script authors to submit their Python script to our popular software site at http://www.myzips.com We have just today added a "Scripts" directory which includes a Python subdirectory http://www.myzips.com/category/Scripts/ The first submissions usually maintai

Re: Python is removing my quotes!

2007-08-21 Thread Nils Oliver Kröger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert Dailey schrieb: > Thank you for your response. The back slashes work! It's a bit annoying; but > I have Microsoft to thank for that. It's not Microsoft, you would experience the same problems under any Unix I know of. At least the bash treats q

Re: How to optimise this code?

2007-08-21 Thread Nils Oliver Kröger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David N Montgomery schrieb: > class testCase: > def __init__(self, tc): > if tc == 1:self.testCase1() > if tc == 2:self.testCase2() > if tc == 3:self.testCase3() > if tc == 4:self.testCase4() > if tc == 5:sel

Re: Regarding Classes

2007-08-21 Thread Colin J. Williams
Lamonte Harris wrote: > What is the main reason of "self" when it involves classes/functions > "self" provides a semi-standard way of addressing the current instance of a class. It is used in an instance's method. It is not typically used in functions. Colin W. -- http://mail.python.org/mail

  1   2   >