Re: goto statement

2005-04-22 Thread Mike Meyer
Grant Edwards [EMAIL PROTECTED] writes: On 2005-04-21, Roy Smith [EMAIL PROTECTED] wrote: Grant Edwards [EMAIL PROTECTED] wrote: Sure, but what about the case where his program is on paper tape and all he has for an editor is an ice pick? Can't you emulate that in emacs with M-X

Re: Manipulating large blobs in Python

2005-04-22 Thread Fredrik Lundh
Tim Stone wrote: I'm working on a module that will manipulate large blobs. I'm using a C dll to allocate big blocks of memory, using PyMem_Malloc, which is working quite well up until I try to manipulate a blob that exhausts Python's heap. how large is that? I'm guessing that to increase the

Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread rkoida
Hello evryone I am a newbie to python. I have a makefile which i can compile in UNIX/LINUX, But i I am planning to write a python script which actually does what my MAKEFILE does. The make file is #Makefile and some scripts to give output #numbers #Change till sign #END var1:=564-574 a1 =

Re: XML parsing per record

2005-04-22 Thread William Park
Willem Ligtenberg [EMAIL PROTECTED] wrote: On Sun, 17 Apr 2005 02:16:04 +, William Park wrote: Care to post more details? The XML file I need to parse contains information about genes. So the first element is a gene and then there are a lot sub-elements with sub-elements. I only need

time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Sheila King
I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked without exception): time.strftime(%Y-%m-%d, (Y, M, D,

Re: Why Python does *SLICING* the way it does??

2005-04-22 Thread Antoon Pardon
Op 2005-04-21, Dan Bishop schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2005-04-21, Steve Holden schreef [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: ... Along the same lines, I think the REQUIREMENT that x[0] rather than x[1] be the first element of list x is a mistake. At least the

Re: regarding system function

2005-04-22 Thread Mike Meyer
praba kar [EMAIL PROTECTED] writes: Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function then It will return 0 only for

Re: regarding system function

2005-04-22 Thread Robert Kern
praba kar wrote: Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function then It will return 0 only for both conditions(success and

Re: How to get a Function object from a Frame object

2005-04-22 Thread Gigi
Greg Ewing wrote: Steven Bethard wrote: Gigi wrote: I need access to a function object that corresponds to a frame object in a certain case from inside the function. Can you look up the code's co_name in the previous frame's locals? You probably also need to check the previous frame's globals...

Noobie Question: Using strings and paths in mkdir (os.mkdir(/test/a))

2005-04-22 Thread Shaun
Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir(/test/a) the last line does not seem to work. os.mkdir(a) makes the directory books, but i want this directory as a subdirectory of test. I also tried: os.mkdir(/test/,a), and

Re: time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Brian van den Broek
Sheila King said unto the world upon 2005-04-22 02:45: I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked

Re: Noobie Question: Using strings and paths in mkdir (os.mkdir(/test/a))

2005-04-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-04-22 00:13:05 -0700: Hello! I can't seem to get paths and variables working together: import os a = 'books' os.chdir( '/test') os.mkdir(/test/a) the last line does not seem to work. os.mkdir(a) makes the directory books, but i want this directory as a

Re: regarding system function

2005-04-22 Thread praba kar
--- Robert Kern [EMAIL PROTECTED] wrote: praba kar wrote: Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function

Re: regarding system function

2005-04-22 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-04-22 08:35:33 +0100: --- Robert Kern [EMAIL PROTECTED] wrote: praba kar wrote: In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python

Re: regarding system function

2005-04-22 Thread Robert Kern
praba kar wrote: I agree above statement but When I delete a directory os.system('rm -rf test') 0 if directory is not present then I again try to delete os.system('rm -rf test') now this time also It will print 0 As Roman Neuhauser says, this is the correct behavior of the -f switch for rm. In

Re: regarding system function

2005-04-22 Thread Fredrik Lundh
praba kar wrote: I agree above statement but When I delete a directory os.system('rm -rf test') 0 if directory is not present then I again try to delete os.system('rm -rf test') now this time also It will print 0 so? if you read the rm man page, you'll find this little paragraph:

Re: To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-22 Thread Dan Polansky
Max, thanks; that was helpful. Roman, your explanation was helpful as well. Dan -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Given # of Characters and no String Input; use RegularExpressions?

2005-04-22 Thread Synonymous
Hello! I was trying to create a program to search for the largest common subsetstring among filenames in a directory, them move the filenames to the substring's name. I have succeeded, with help, in doing so and here is the code. Thanks for your help! --- Code --- #This program was created

Re: deprecation of has_key?

2005-04-22 Thread Just
In article [EMAIL PROTECTED], Terry Reedy [EMAIL PROTECTED] wrote: Steven Bethard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ahh, ok. Now I understand. I think you could probably search the python-dev archives and see why the decision was made as it was. For pretty

Re: Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread Simon Brunning
On 21 Apr 2005 23:39:03 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Kindly suggest me some ideas/comments. Why don't you make a start, and come back to us with whatever problems you encounter? We're happy to help, but we aren't going to do it for you. Andrew Dalke's Wrapping command-line

Re: Noobie Question: Using strings and paths in mkdir (os.mkdir(/test/a))

2005-04-22 Thread Simon Brunning
On 4/22/05, Roman Neuhauser [EMAIL PROTECTED] wrote: import os a = 'books' os.chdir( '/test') os.mkdir(/test/a) the last line does not seem to work. os.mkdir(a) makes the directory books, but i want this directory as a subdirectory of test.

Re: Regular Expressions - Python vs Perl

2005-04-22 Thread Ville Vainio
Ilpo == Ilpo Nyyssnen iny writes: Ilpo James Stroud [EMAIL PROTECTED] writes: Is it relevant that Python can produce compiled expressions? I don't think that there is such a thing with Perl. Ilpo The problem in python here is that it needs to always Ilpo recompile the

pylab strange error message

2005-04-22 Thread [EMAIL PROTECTED]
I found this error message when I import pylab. from pylab import * Error message: Microsoft Visual C++ Runtime Library Assertion failed! Program:c\python24\python.exe File:CXX/cxx_extentions.cxx Line:1031 Expression: ob_refcnt == 0 For information on how your program can cause an assertion

Re: How to prevent Tkinter frame resize?

2005-04-22 Thread Martin Franklin
[EMAIL PROTECTED] wrote: I am trying to prevent a user from resizing a frame beyond its natural size as given by winfo_reqwidth and winfo_reqheight, without any success. Can anyone make any suggestions, based on my code below? Thanks! from Tkinter import * class Table(Frame): def

Re: Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread hue
Thanks for your reply I started writing the script.. I have gone through documentation for getopt import string, getopt, sys def usage(): print '''myscript.py -- uses getopt to recognize options Options: -n -- No -t -- T -h -- help -i -- i -o --

Re: time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Raymond Hettinger
[Sheila King] I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked without exception):

Re: Run Unix shell command $ parse command line arguments in python

2005-04-22 Thread Simon Brunning
On 22 Apr 2005 03:16:02 -0700, hue [EMAIL PROTECTED] wrote: Thanks for your reply I started writing the script.. I have gone through documentation for getopt (snip) Good start. I tend to prefer optparse over getopt these days, but if you've got it working the way you want it, you should

Re: Persistent python object and the Web

2005-04-22 Thread bruno modulix
[EMAIL PROTECTED] wrote: Hi, I'd like to know if I am trying to do something impossible or I am just being unable to find how to do it. In the latter case, please... help me... (snip) My problem is that I don't know how to create a graph_object that remains persistent through time (it has to be

Re: Regular Expressions - Python vs Perl

2005-04-22 Thread Ilpo Nyyssönen
Ville Vainio [EMAIL PROTECTED] writes: Ilpo == Ilpo Nyyssönen iny writes: Ilpo The problem in python here is that it needs to always Ilpo recompile the regexp. I would like to have a way to write a Ilpo regexp as a constant and then python should compile that Ilpo regexp to

Re: XML parsing per record

2005-04-22 Thread Willem Ligtenberg
This is all the info I need from the xml file: ID -- Gene-track_geneid320632/Gene-track_geneid Name --Gene-ref Gene-ref_locusPzp/Gene-ref_locus Startbase -- Gene-commentary_seqs Seq-loc Seq-loc_int Seq-interval

Re: whitespace , comment stripper, and EOL converter

2005-04-22 Thread M.E.Farmer
Hello Jean, Glad to see your still playing along. I have tested your script and it is broken too :( Good idea about checking for the ':' , it just doesn't cover every case. This is the very reason I had not included docstring support before! The problem is more diffcult than it first appears, I am

__init__.py question

2005-04-22 Thread codecraig
Ok, I have the following directory structure C:\pycode -- blah.py -- mynewdir -- __init__.py -- abc.py [[ C:\pycode\mynewdir\abc.py ]] def doFoo(): print hi def doBar(): print bye [[ C:\pycode\mynewdir\__init__.py ]] from mynewdir import * [[ C:\pycode\blah.py ]]

Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2

2005-04-22 Thread Bill Davy
Traceback (most recent call last): File stdin, line 1, in ? ImportError: No module named SHIP Two common problems here: 1) There is no file *\SHIP.pyd where * is one entry of sys.path 2) The capitalization is not correct. The file lookup will succeed, but then, when initSHIP(void) is

Re: time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Kent Johnson
Raymond Hettinger wrote: Since the rules for handling missing, inconsistent, or out-of-range tuple fields are not defined, even that revision has some risk. To future-proof the code, use strptime() to generate a well-formed time tuple: strptime('%d-%d-%d' % (y,m,d), '%Y-%m-%d') (2005, 5, 15, 0,

Re: How to run Python in Windows w/o popping a DOS box?

2005-04-22 Thread pyguy2
click on my computer Then select tools-folder options-File Types scroll down the where the py extension is defined, highlight it, click on advanced then highlight open and hit the edit button. There you should see python.exe with some other stuff, change it to pythonw.exe Then, in the future,

IDLE: How to point it to the Python executables I want it to see on Windows

2005-04-22 Thread Bill Davy
Assuming they run as a separate thread, I want to point IDLE to .../Debug/Python_d.exe one day and .../Release/Python.exe for the next. Also, is there any easy way to run the .../Debug/Python_d.exe so started under the MSVC debugger? tia, Bill --

SSL Server Socket Support in Python?

2005-04-22 Thread André Søreng
I'm trying to create a SSL-enabled server in Python, and in the doc for the socket module: ssl(sock[, keyfile, certfile]) Initiate a SSL connection over the socket sock. keyfile is the name of a PEM formatted file that contains your private key. certfile is a PEM formatted certificate

Re: SSL Server Socket Support in Python?

2005-04-22 Thread Jp Calderone
On Fri, 22 Apr 2005 14:59:59 +0200, André Søreng [EMAIL PROTECTED] wrote: I'm trying to create a SSL-enabled server in Python, and in the doc for the socket module: ssl(sock[, keyfile, certfile]) Initiate a SSL connection over the socket sock. keyfile is the name of a PEM formatted file

Re: XML parsing per record

2005-04-22 Thread Willem Ligtenberg
As I'm trying to write the code using cElementTree. I stumble across one problem. Sometimes there are multiple values to retrieve from one record for the same element. Like this: Prot-ref_name_EATP-binding cassette, subfamily G, member 1/Prot-ref_name_E Prot-ref_name_EATP-binding cassette

Re: XML parsing per record

2005-04-22 Thread Willem Ligtenberg
By the way, I know about findall, but when I iterate thruogh it like: for x in function: print 'function', x I get: function Element 'Prot-ref_name_E' at 0xb7d10cf8 function Element 'Prot-ref_name_E' at 0xb7d10d10 But ofcourse I want the information in there... On Fri, 22 Apr 2005

Re: Why Python does *SLICING* the way it does??

2005-04-22 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: Other possibility, probably faster when almost all keys in the range are in the dictionary: class sdict(dict): def __getitem__(self, index): if isinstance(index, slice): d = {} for key in xrange(slice.start, slice.stop,

Re: goto statement

2005-04-22 Thread Reinhold Birkenfeld
Grant Edwards wrote: On 2005-04-21, Sergei Organov [EMAIL PROTECTED] wrote: Well, I'm writing for embedded realtime systems in C/C++ and have never encountered a single need to use goto. I have encountered situations in C programs where the best thing to use was a goto. Those situations

Re: XML parsing per record

2005-04-22 Thread Fredrik Lundh
Willem Ligtenberg wrote: As I'm trying to write the code using cElementTree. I stumble across one problem. Sometimes there are multiple values to retrieve from one record for the same element. Like this: Prot-ref_name_EATP-binding cassette, subfamily G, member 1/Prot-ref_name_E

Re: time.strftime in 2.4.1 claims data out of range when not

2005-04-22 Thread Tim Peters
[Sheila King] I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an error on this code (that has previously worked without exception):

Re: goto statement

2005-04-22 Thread Reinhold Birkenfeld
Grant Edwards wrote: On 2005-04-21, Sergei Organov [EMAIL PROTECTED] wrote: Grant Edwards [EMAIL PROTECTED] writes: On 2005-04-21, Peter Maas [EMAIL PROTECTED] wrote: Maxim Kasimov schrieb: but what if i just can't to do this becouse i'm working thrue ssh, and have to use only installed

Re: XML parsing per record

2005-04-22 Thread Willem Ligtenberg
As you can read in the other post of mine, my problem was with the iterating through the list. didn't know that you should do. e.text. I did only print e, not print e.text Did read documentation, but must admit not everything. Anyway, thank you very much! On Fri, 22 Apr 2005 15:47:08 +0200,

Re: XML parsing per record

2005-04-22 Thread Fredrik Lundh
Willem Ligtenberg wrote: By the way, I know about findall, but when I iterate thruogh it like: for x in function: print 'function', x I get: function Element 'Prot-ref_name_E' at 0xb7d10cf8 function Element 'Prot-ref_name_E' at 0xb7d10d10 But ofcourse I want the information in there... for x in

Re: goto statement

2005-04-22 Thread Grant Edwards
On 2005-04-22, Reinhold Birkenfeld [EMAIL PROTECTED] wrote: Sure, but what about the case where his program is on paper tape and all he has for an editor is an ice pick? Then inserting goto doesn't seem to be an acceptable option either ;) Scissors, tape, and a box full of prepunched goto

Re: goto statement

2005-04-22 Thread Peter Hansen
Grant Edwards wrote: Sure, but what about the case where his program is on paper tape and all he has for an editor is an ice pick? Paper tape? Luxury -- http://mail.python.org/mailman/listinfo/python-list

Problem deriving a class from the built-in file object

2005-04-22 Thread Pierre Rouleau
Hi all! I'm trying to extend the functionality of the file object by creating a class that derives from file. MyFile class re-implements __init__(), write(), writelines() and close() to augment the capabilities of file. All works fine, except for one thing: 'print myfile' does not execute

Re: Regular Expressions - Python vs Perl

2005-04-22 Thread Ville Vainio
Ilpo == Ilpo Nyyssnen iny writes: Ilpo Of course it caches those when running. The point is that it Ilpo needs to recompile every time you have restarted the Ilpo program. With short lived command line programs this really Ilpo can be a problem. I didn't imagine it could be

Re: Regular Expressions - Python vs Perl

2005-04-22 Thread Terry Hancock
On Thursday 21 April 2005 09:01 am, codecraig wrote: I am interested in regular expressions and how Perl and Python compare. Particulary, I am interested in performance (i.e. speed), memory usage, flexibility, completeness (i.e. supports simple and complex regex operations...basically is

Re: Why Python does *SLICING* the way it does??

2005-04-22 Thread Peter Hansen
Rocco Moretti wrote: Steve Holden wrote: The principle of least surprise is all very well, but needless surprise of newbies is a dangerous criterion to adopt for programming language design and following it consistently would lead to a mess like Visual Basic, which grew by accretion until

Re: Resolving 10060, 'Operation timed out'

2005-04-22 Thread Peter Hansen
willitfw wrote: I'm including the code that I've been using. I am relatively new to python, and not sure if a socket was created: * import socket socket.setdefaulttimeout(None) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) The last line above creates a socket... and I

Test mail please ignore

2005-04-22 Thread Vedanta Barooah
-- *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*Vedanta BarooahYM! - vedanta2006Skype - vedanta2006-- http://mail.python.org/mailman/listinfo/python-list