Re: HELP: Searching File Manager written in Python

2005-10-12 Thread anton
To answer to you both: The Norton Commander was a popular file manager for DOS, but the idea of the 2 window concept is still used by a lot of software. On Linux the one I use is Midnight Commander (mc). On Windows there are the 7-zip file manager see http://www.7-zip.org/ (7-zip is also a new c

Re: A problem while using urllib

2005-10-12 Thread Steve Holden
Johnny Lee wrote: > Alex Martelli wrote: > >>Johnny Lee <[EMAIL PROTECTED]> wrote: >> ... >> >>> try: >>> webPage = urllib2.urlopen(url) >>> except urllib2.URLError: >> >> ... >> >>> webPage.close() >>> return True >>> >>> >>>

Re: List performance and CSV

2005-10-12 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > But a really fast approach is to use a dictionary or other structure > that turns the inner loop into a fast lookup, not a slow loop through > the 'Customers' list. Another approach is to sort both sequences, loop over both in one loop and just update the index for the

Re: OT: Phases of the moon

2005-10-12 Thread Cruise Director
Ulrich Hobelmann wrote: > Paul F. Dietz wrote: > > Bart Lateur wrote: > > > >> As a similar example: I've been told by various women independently, > >> that "there are more babies born near a full moon." > > > > That's also a myth. > > Right, everybody knows that it's not natural (moon) light tha

Re: can we save print msg into a file when script running ?

2005-10-12 Thread Steve Holden
black wrote: > hi all~ > > in my .py file there are a few print to trace out some message and i > wonder if we can save it into a specified file when that script get > running. if so, i may just check that file to c how the script is > running. can anyone show me a right direction ? > > one milli

Re: can we save print msg into a file when script running ?

2005-10-12 Thread Maksim Kasimov
black wrote: > hi all~ > > in my .py file there are a few print to trace out some message and i > wonder if we can save it into a specified file when that script get > running. if so, i may just check that file to c how the script is > running. can anyone show me a right direction ? > > one milli

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Steve Holden
Rune Strand wrote: > Is it an idea to include a new __filename__ predefined attribute to > 2.5, so that __file__ contains the entire path to the module, and > __filename__ only the name of the module? > > For instance it's useful to include a not-static reference to the > filename in a scripts usa

Re: A problem while using urllib

2005-10-12 Thread Johnny Lee
Steve Holden wrote: > Johnny Lee wrote: > > Alex Martelli wrote: > > > >>Johnny Lee <[EMAIL PROTECTED]> wrote: > >> ... > >> > >>> try: > >>> webPage = urllib2.urlopen(url) > >>> except urllib2.URLError: > >> > >> ... > >> > >>> webPage.close() > >>> return True > >>>-

Re: HELP: Searching File Manager written in Python

2005-10-12 Thread Andrew Markebo
Checked Total Commander? Has an sort of open API to plugins, and either do a python 'proxy' or maybe just execute a script. Next step might be using win32com or SWIG to set up the interface.. Just some ideas. /Andy -- Everything that was magical was just a way of describing the world in

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Rune Strand
I Steve, I know it's several ways to isolate the filename. I just want to avoid the overhead of importing sys or os to achieve it. Currently I have this in my scripts: __filename__ = __file__.replace('\\', '/').rsplit('/', 1)[-1] -- http://mail.python.org/mailman/listinfo/python-list

Make SimpleXMLRPCServer Require Auth?

2005-10-12 Thread John Abel
Hi, I implemented a SimpleXMLRPCServer, modified it slightly to restrict clients based on their IP, but I need to take it a stage further, and add user authentication. I would appreciate any pointers as to how I might go about this, or any packages which already provide this. I'm guessing th

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Rune Strand wrote: > I Steve, > > I know it's several ways to isolate the filename. I just want to avoid > the overhead of importing sys or os to achieve it. What overhead? Besides: if you want to do python this, why don't we introduce the function solve_my_problems() that is the only thing a

Re: win32com, generating the cache programaticaly?

2005-10-12 Thread Andrew Markebo
| You can use win32com.client.gencache.EnsureDispatch | to automatically generate the makepy file for an object's library | when the object is created. Use the bForDemand option to | only generate the code for objects as needed. Drats, I get an: raise TypeError, "This COM object can not automa

Re: A problem while using urllib

2005-10-12 Thread Steve Holden
Johnny Lee wrote: > Steve Holden wrote: > >>Johnny Lee wrote: >> >>>Alex Martelli wrote: >>> >>> Johnny Lee <[EMAIL PROTECTED]> wrote: ... > try: > webPage = urllib2.urlopen(url) > except urllib2.URLError: ... > webPage.close() >

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Stefan Rank
on 12.10.2005 10:02 Diez B. Roggisch said the following: > Rune Strand wrote: > >>Currently I have this in my scripts: >>__filename__ = __file__.replace('\\', '/').rsplit('/', 1)[-1] > > This is neither platform independent nor less "overhead". This is: > > import os > __filname__ = os.path.spli

Re: Python's Performance

2005-10-12 Thread bruno modulix
Alex Stapleton wrote: > > On 9 Oct 2005, at 19:04, Bruno Desthuilliers wrote: > > >> Laszlo Zsolt Nagy a écrit : (snip) >>> Do you want to know how many internal string operations are done inside >>> the Python interpreter? I believe it is not a useful information. There >>> are benchmarks tes

Re: Python's Performance

2005-10-12 Thread bruno modulix
Donn Cave wrote: > Quoth "Fredrik Lundh" <[EMAIL PROTECTED]>: > | Alex Stapleton wrote > | > | > Except it is interpreted. > | > | except that it isn't. Python source code is compiled to byte code, which > | is then executed by a virtual machine. if the byte code for a module is up > | to date, t

Re: Why asci-only symbols?

2005-10-12 Thread Martin v. Löwis
Mike Meyer wrote: > Out of random curiosity, is there a PEP/thread/? that explains why > Python symbols are restricted to 7-bit ascii? No PEP yet; I meant to write one for several years now. The principles would be - sources must use encoding declarations - valid identifiers would follow the Unic

Re: A problem while using urllib

2005-10-12 Thread Steve Holden
Steve Holden wrote: > Johnny Lee wrote: > [...] > >>I've sent the source, thanks for your help. >> > > [...] > Preliminary result, in case this rings bells with people who use urllib2 > quite a lot. I modified the error case to report the actual message > returned with the exception and I'm see

crosswords helper program

2005-10-12 Thread gg
I plan to write a program in Python in order to help me doing crosswords, I was wondering if such a program already existed. Basically it will get the number of letters of the word (5, 10, 12...) then the letters known (B in second letter, E in 5th letter...) and then search in a dictionary the

Re: Nicer way of strip and replace?

2005-10-12 Thread Markus Rosenstihl
On 2005-10-12 01:29:28 +0200, Paul Rubin said: > > Oh cool. I think you could even say: > >rechnung = list(read_file) > > instead of the for loop. Yes, that is working too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Rune Strand
Excuse me, do you suffer from a bad hair-day? I didn't say it is platform independant. It's ok for my use on Linux and Windows. If you cannot imagine any other usecase for a __filename__ attribute, that's your problem, not mine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Jargons of Info Tech industry

2005-10-12 Thread Casper H.S.Dik
Steven D'Aprano <[EMAIL PROTECTED]> writes: >On Tue, 11 Oct 2005 14:27:30 +, axel wrote: >> I don't know how much spam other people receive but on one account I >> hardly receive any as I reserve it for friends and business. On another >> I had about 40 spam messages which took all of ten sec

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Fredrik Lundh
Rune Strand wrote: > I know it's several ways to isolate the filename. I just want to avoid > the overhead of importing sys or os to achieve it. those modules are already imported when Python gets to your code, so the only "overhead" you're saving is a little typing. > Currently I have this in

Re: crosswords helper program

2005-10-12 Thread Lasse Vågsæther Karlsen
gg wrote: > I plan to write a program in Python in order to help me doing > crosswords, I was wondering if such a program already existed. > > Basically it will get the number of letters of the word (5, 10, 12...) > then the letters known (B in second letter, E in 5th letter...) and then > sear

mod_python mptest.py works publisher not

2005-10-12 Thread Python_it
I'm going to work with mod_python. I install mod_python 3.2.2b for python 2.4. If i test my install with mptest.py see this link: http://www.modpython.org/live/mod_python-3.2.2b/doc-html/modpython.html IT WORKS! But if i try this: AddHandler mod_python .py PythonHandler mod_python.publisher Py

another error in tagging program

2005-10-12 Thread enas khalil
hello all i have run  the following code :# the taggerI interfacefrom nltk.tagger import *from nltk.tokenizer import WhitespaceTokenizerfrom nltk.tokenizer import *from nltk.token import * # Using UnigramTagger##Before aUnigramTagger can be used to tag data ,it must be trained on training corpus,#

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Chris Smith
> "Sebastian" == Sebastian Bassi <[EMAIL PROTECTED]> writes: Sebastian> On 9/30/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >> after Guido's pronouncement yesterday, in one of the next >> versions of Python there will be a conditional expression with >> the following syn

Need a spider library

2005-10-12 Thread Laszlo Zsolt Nagy
Hi All, I'm writting a spider program. I need to go to serveral URLs and extract information from the HTML source. Including links. I was using FancyURLOpener and my own function that extracts the links from a HTML page. The problem is that I always need to change it. This is because some sit

Re: A problem while using urllib

2005-10-12 Thread Johnny Lee
Steve Holden wrote: > Steve Holden wrote: > > Johnny Lee wrote: > > [...] > > > >>I've sent the source, thanks for your help. > >> > > > > [...] > > Preliminary result, in case this rings bells with people who use urllib2 > > quite a lot. I modified the error case to report the actual message > >

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Piet van Oostrum
> Paul Rubin (PR) wrote: >PR> Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: >>> For a conditional, syntax must be found, and the tradition of Python >>> design is not to use punctuation for something that can be solved with >>> keywords. >PR> Yeah, "if C then A el

wrapping single classes in an extension module

2005-10-12 Thread Stefan Behnel
Hi! In a project, I'm providing an API that is made up by augmenting XML DOM elements with tag specific attributes and methods. These actually operate on the DOM and fulfill the need of making the DOM API more user friendly and domain specific. I currently use PyXML/4DOM and I'm considering movin

Re: Need a spider library

2005-10-12 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: > The question: is there a good library for Python for extraction links and > images > out of (possibly malformed) HTML soucre code? http://www.crummy.com/software/BeautifulSoup/ -- http://mail.python.org/mailman/listinfo/python-list

Re: bizarro world

2005-10-12 Thread Piet van Oostrum
> Bryan <[EMAIL PROTECTED]> (B) wrote: >B> omg!!! wow!!! after reading this i feel like i just stepped in to some >B> bizarro world. So why do you have to repeat the whole thing?? I have kill-filed XL, and now you put the message in my face. Please don't react to this drivel. -- Piet van O

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Duncan Booth
Chris Smith wrote: > What I really want to do is take four lines of conditional, and put > them into one, as well as blow off dealing with a 'filler' variable: > > return "the answer is " + "yes" if X==0 else "no" > > > Or whatever the final release syntax is. The syntax is fine, but the seman

Re: Need a spider library

2005-10-12 Thread Laszlo Zsolt Nagy
Fredrik Lundh wrote: >Laszlo Zsolt Nagy wrote: > > > >>The question: is there a good library for Python for extraction links and >>images >>out of (possibly malformed) HTML soucre code? >> >> > >http://www.crummy.com/software/BeautifulSoup/ > > Thanks a lot! This is just what I wanted. W

A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread Antoon Pardon
Comments are welcome: http://www.pardon-sleeuwaegen.be/antoon/avltree.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to(can we ?) pass argument to .py script ?

2005-10-12 Thread billie
It's quite simple. If this usage example can helps you... ### parser try: opts, args = getopt.getopt(sys.argv[1:], "h, e, p:", ["help"]) mode = 'reply' # default mode pwd = ' ' # default pass (blank) for o, a in opts: if o == '--help' or o == '-h': print helper(

C Extension - return an array of longs or pointer?

2005-10-12 Thread Java and Swing
Hi, I have been posting about writing a C extension for Python...so far, so good. At least for the "simple" functions that I need to wrap. Ok, my c function looks like... MY_NUM *doNumberStuff(const char *in, const char *x) { ... } MY_NUM is defined as, typedef unsigned long MY_NUM; (not su

Re: Need a spider library

2005-10-12 Thread Walter Dörwald
Laszlo Zsolt Nagy wrote: > [...] > For example this malformed link: > > http://samplesite.current_location/page.html','Samle link'] Your options AFAIK are: * Beautiful Soup (http://www.crummy.com/software/BeautifulSoup/) * Various implementations of tidy (uTidyLib, mxTidy) * XIST (http://www.liv

Re: C Extension - return an array of longs or pointer?

2005-10-12 Thread Brandon K
All the veteran programmers out there can correct me, but the way I did it in my extension was this: static PyObject *wrap_doNumberStuff(PyObject* self, PyObject* args) { char* in = 0; char* x = 0; long* result = 0; int i = 0; PyObject* py = PyTuple_New()

Re: IDLE dedent/unindent key bindings for non-us keybord?

2005-10-12 Thread Adriaan Renting
You could try using the Qscintilla based Eric3 IDE, it uses Ctrl-i and Ctrl-Shift-i. >>><[EMAIL PROTECTED]> 10/02/05 5:52 pm >>> |What could be wrong here, and do you have any other suggestions for a |"dedent" key binding that may work on a non-us/swedish keyboard (or |maybe an alternative e

Re: C Extension - return an array of longs or pointer?

2005-10-12 Thread Brandon K
I'm sorry...I just woke up and forgot my C...must have left it in the Coffee...Anyway, i made a few mistakes (can't initialize blank tuple...function should return a value, lol). static PyObject* wrap_doNumberStuff(PyObject* self, PyObject* args) { char* in = 0; char* x = 0;

C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // this will store the result in a Python object PyObject *finalResult; // get arguments from Python char *result = 0; char *in= 0; char *aString = 0; char *bString = 0;

Re: C Extension - return an array of longs or pointer?

2005-10-12 Thread Java and Swing
Interesting...thanks. Any good tutorials out there, other than the python doc for ext? thanks. Brandon K wrote: > All the veteran programmers out there can correct me, but the way I did > it in my extension was this: > > static PyObject *wrap_doNumberStuff(PyObject* self, PyObject* args) > { >

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
update: if I use C's free(result), free(a) free(b) instead of PyMem_Free...I only get one successfuly use/call of doStuff. i.e. // this works doStuff(...) // python crashes here doStuff(...) Java and Swing wrote: > static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { > // this w

calling matlab

2005-10-12 Thread Mohammed Smadi
Hi; Does anyone know if we can call matlab for a python or bash script while feeding the matlab script some command line arguments? I have an interactive matlab script which i want to automate by feeding the args from a script. I know this is probably more suitable to a matlab group but any i

Re: Converting C++ array into Python

2005-10-12 Thread Adriaan Renting
try using SWIG? You give very little information about how you are trying to accomplish this. From your mention of C++ you seem to mean a vector, not an array, I suggest you read the documentation of SWIG, and maybe someone can help you if you give a clear example of what you are trying to accom

Re: IDLE dedent/unindent key bindings for non-us keybord?

2005-10-12 Thread Franz Steinhaeusler
On Wed, 12 Oct 2005 14:58:18 +0200, "Adriaan Renting" <[EMAIL PROTECTED]> wrote: >You could try using the Qscintilla based Eric3 IDE, it uses Ctrl-i and >Ctrl-Shift-i. > That is possible. But what has it to do with the original post? Apart from that, in Idle you can bind them it to Ctrl-i an

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
one more update... if I remove PyMem_Free and free(...) ...so no memory clean up...I can still only call doStuff 4 times, the 5th attemp crashes Python. Java and Swing wrote: > update: > if I use C's free(result), free(a) free(b) instead of PyMem_Free...I > only get one successfuly use/call of do

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Antoon Pardon
Op 2005-10-12, Java and Swing schreef <[EMAIL PROTECTED]>: > static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { > // this will store the result in a Python object > PyObject *finalResult; > > // get arguments from Python > char *result = 0; > char *in= 0;

Re: searching python/gui developper in germany

2005-10-12 Thread malv
Hans Georg Krauthaeuser wrote: > Dear all, > > for the measurements in our labs we have developed python scripts that > are pretty fine for our needs. Basically, we have classes and call the > appropriate methods from the command line (or by other scripts). So, we > don't have any GUI. > > Now, an

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
Antoon, I just saw that to. I updated the code like so... static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // this will store the result in a Python object PyObject *finalResult; // get arguments from Python char *result = 0; char *in= 0;

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
Antoon, I just saw that to. I updated the code like so... static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // this will store the result in a Python object PyObject *finalResult; // get arguments from Python char *result = 0; char *in= 0;

Re: A problem while using urllib

2005-10-12 Thread Steve Holden
Johnny Lee wrote: > Steve Holden wrote: > >>Steve Holden wrote: >> >>>Johnny Lee wrote: [...] >> >>So my conclusion is that there's something in the Cygwin socket module >>that causes problems not seen under other platforms. >> >>I couldn't find any obviously-related error in the Python bug tracke

Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
I have a program with this code fragment: print len(data) print data[:50] raise SystemExit This prints: 20381 http://mail.python.org/mailman/listinfo/python-list

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
Sorry about the double post... anyhow, after putting in debug statements I found that it was crashing when it called, free(result)so I removed the free(result). now it crashes when it gets to, b = GetVal(bString, count(bString, ",")); ..any ideas? Java and Swing wrote: > Antoon, >I just

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
Laszlo Zsolt Nagy wrote: >I have a program with this code fragment: > >print len(data) >print data[:50] >raise SystemExit > >This prints: > >20381 > >But if I change 50 to 51 > >print len(data) >print data[:51] >raise SystemExit > >then it prints > >20381 > !DOCTYPE html PU

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread Steve Holden
Antoon Pardon wrote: > Comments are welcome: > > http://www.pardon-sleeuwaegen.be/antoon/avltree.html Does this type bear any relationship at all to what most people call a tree, which is a bifurcated data structure? Or do you call it a tree for some other reason? Sounds like "cdict" might be

Re: crosswords helper program

2005-10-12 Thread Chris F.A. Johnson
On 2005-10-12, gg wrote: > I plan to write a program in Python in order to help me doing > crosswords, I was wondering if such a program already existed. > > Basically it will get the number of letters of the word (5, 10, 12...) > then the letters known (B in second letter, E in 5th letter...) an

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread Antoon Pardon
Op 2005-10-12, Steve Holden schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: >> Comments are welcome: >> >> http://www.pardon-sleeuwaegen.be/antoon/avltree.html > Does this type bear any relationship at all to what most people call a > tree, which is a bifurcated data structure? Or do you c

Re: can we save print msg into a file when script running ?

2005-10-12 Thread black
unluckly i am with windows, anyway tks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: can we save print msg into a file when script running ?

2005-10-12 Thread black
quote: === script.py >> script.log 2>&1 === what does 2>&1 mean pls ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Very dumb question

2005-10-12 Thread Rocco Moretti
Laszlo Zsolt Nagy wrote: > Laszlo Zsolt Nagy wrote: > >> I have a program with this code fragment: >> >>print len(data) >>print data[:50] >>raise SystemExit >> >> This prints: >> >> 20381 >> > >> But if I change 50 to 51 >> >>print len(data) >>print data[:51] >>raise System

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread dataw0lf
Steve Holden wrote: > Does this type bear any relationship at all to what most people call a > tree, which is a bifurcated data structure? Or do you call it a tree for > some other reason? I'd think that the 'avl' part would answer that question. !google avl tree -- Joshua Simpson -- dataw0

Re: Very dumb question

2005-10-12 Thread bruno modulix
Laszlo Zsolt Nagy wrote: > I have a program with this code fragment: > >print len(data) >print data[:50] >raise SystemExit > > This prints: > > 20381 > > But if I change 50 to 51 > >print len(data) >print data[:51] >raise SystemExit > > then it prints > > 20381 > !DO

Re: Very dumb question

2005-10-12 Thread Peter Otten
Laszlo Zsolt Nagy wrote: > I have a program with this code fragment: > > print len(data) > print data[:50] > raise SystemExit > > This prints: > > 20381 > > But if I change 50 to 51 > > print len(data) > print data[:51] > raise SystemExit > > then it prints > > 20381 > !DOCTYPE html PUBLIC

Re: can we save print msg into a file when script running ?

2005-10-12 Thread Peter Otten
black wrote: > in my .py file there are a few print to trace out some message and i > wonder if we can save it into a specified file when that script get > running. if so, i may just check that file to c how the script is > running. can anyone show me a right direction ? If you don't feel comfort

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
ok, further digging...I found that in the C function GetVal...it is crashing where I try to malloc some memory. Note, I have no problems when running this from C..just from Python using my wrapper. GetVal looks something like.. MY_NUM *GetVal(const char *in, const int x) { MY_NUM *results, *re

Re: C Extension - return an array of longs or pointer?

2005-10-12 Thread Bernhard Herzog
Brandon K <[EMAIL PROTECTED]> writes: > long* result = 0; [...] > result = doNumberStuff(in,x); > len = sizeof(result)/sizeof(long); I don't think this will do what you appear to expect it to do. Bernhard -- Intevation GmbH http://intevation.

Re: can we save print msg into a file when script running ?

2005-10-12 Thread Steve Holden
black wrote: > quote: > === > script.py >> script.log 2>&1 > === > > what does 2>&1 mean pls ? > It's Unix shell-speak for "send the standard error stream to the same place as the standard output". Probably a syntax error on Windows ... regards Steve --

RE: Very dumb question

2005-10-12 Thread David Stockwell
Indeed,Are you writing a new book? http://www.amazon.com/exec/obidos/ASIN/1563052857/wildwierdmathpro David --- Surf a wave to the future with a free tracfone http://cellphone.duneram.com/index.html >From: Laszlo Zsolt Nagy <[EMAIL PROTECTED]> >To: python-list@python.org >Subject: V

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
> >I assume the code snippets are exact copy/paste so this is not a typo >(like print data[51:] ...) - and I can't reproduce it here... even with >a string of 20381 characters. > > Yes, they were cut out. type(data) returns ''. The data was downloaded from a website, it starts with http://www.w

Re: Jargons of Info Tech industry

2005-10-12 Thread Mike Meyer
Casper H.S. Dik <[EMAIL PROTECTED]> writes: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >>Can I remind you that spam is approximately 70% of all email traffic these >>days? Most of that is blocked by the ISPs, but even so you are obviously >>one of the lucky few. > > 95% - 99% of all email, not 7

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
David Stockwell wrote: > Indeed,Are you writing a new book? > > http://www.amazon.com/exec/obidos/ASIN/1563052857/wildwierdmathpro I'm not, but thanks for asking. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Very dumb question

2005-10-12 Thread Laszlo Zsolt Nagy
>i. e. a character after a 'carriage return' ('\r') overwrites part of the >string which therefore doesn't seem to grow. Try > >print repr(data[:51]) > >to see what's really in your data string. > > Yes, that was it! Thanks for you help. I thought it will be something obvious. The server retu

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Dave Hansen
On Tue, 11 Oct 2005 01:06:30 -0400, "George Sakkis" <[EMAIL PROTECTED]> wrote: >"Dave Hansen" <[EMAIL PROTECTED]> wrote: > >> On Mon, 10 Oct 2005 16:42:34 -0500, Terry Hancock >> <[EMAIL PROTECTED]> wrote: >> >> >On Sunday 09 October 2005 07:50 am, phil hunt wrote: >> >> On Fri, 7 Oct 2005 01:05:1

Re: Make SimpleXMLRPCServer Require Auth?

2005-10-12 Thread John Abel
John Abel wrote: >Hi, > >I implemented a SimpleXMLRPCServer, modified it slightly to restrict >clients based on their IP, but I need to take it a stage further, and >add user authentication. I would appreciate any pointers as to how I >might go about this, or any packages which already provide

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-12 Thread Dave Hansen
On Wed, 12 Oct 2005 13:02:20 +0200, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >> Paul Rubin (PR) wrote: > [...] > >>PR> Yeah, "if C then A else B" is a ancient tradition stretching from >>PR> Algol-60 to OCAML, and who knows what all else in between. I'm not >>PR>

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Rune Strand wrote: > Excuse me, do you suffer from a bad hair-day? I didn't say it is > platform independant. It's ok for my use on Linux and Windows. If you > cannot imagine any other usecase for a __filename__ attribute, that's > your problem, not mine. I think you are the one who wants __filen

Re: Adding a __filename__ predefined attribute to 2.5?

2005-10-12 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > And requesting random features built into the interpreter without even > specifying a usecase - as remote as it may be - isn't very likely > happen, don't you think? Which I wanted to express with my apparently > misunderstood solve_my_problem()-example. Reread your po

Agile Job Opening at Lond Island, NY

2005-10-12 Thread dimus
We are looking for an Agile/XP developer to expand our small team of programmers (5 members). This is a full time position. For more information about this posting go to: http://naples.cc.sunysb.edu/Admin/CampusJob.nsf/af51a98c4c56cd5c85256731006ae132/ed74d7b69bd353428525709200571558?OpenDocument

Re: calling matlab

2005-10-12 Thread Robert Kern
Mohammed Smadi wrote: > Hi; > > Does anyone know if we can call matlab for a python or bash script while > feeding the matlab script some command line arguments? I have an > interactive matlab script which i want to automate by feeding the args > from a script. Depending on how interactive it

Re: can we save print msg into a file when script running ?

2005-10-12 Thread Fredrik Lundh
Steve Holden wrote: >> what does 2>&1 mean pls ? >> > It's Unix shell-speak for "send the standard error stream to the same > place as the standard output". Probably a syntax error on Windows ... > more test.py import sys sys.stdout.write("stdout!\n") sys.stderr.write("stderr!\n") > python test.

Re: A Tree class, my $0.02 contribution to the python community.

2005-10-12 Thread George Sakkis
"Antoon Pardon" <[EMAIL PROTECTED]> wrote: > Comments are welcome: > > http://www.pardon-sleeuwaegen.be/antoon/avltree.html How about adding two shortcut methods, nextkey(k) and prevkey(k), to return the next and previous key respectively ? For instance nextkey would be equivalent to (untested)

Windows memory pointers in Python?

2005-10-12 Thread Gregory Piñero
Hi guys, I'm really lost of on this one.  How can I turn this (VB?) code into Python?  Basically I call a function exposed from a dll and it returns me what I believe is a pointer to a location in memory?  Now I need to read that area to get the string I need.  This link has the solution but it is

Listen for directory events

2005-10-12 Thread Bell, Kevin
Anyone have any advice on listening for directory events? I'd like to fire off my script if new files are added to a directory. Right now, I've set up my script as a scheduled task (Windows XP) and when the script is run periodically, it initially looks for new files and does it's magic if there

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Bernhard Herzog
"Java and Swing" <[EMAIL PROTECTED]> writes: > static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { [...] > char *aString = 0; > char *bString = 0; [...] > int ok = PyArg_ParseTuple(args, "sss", &in, &aString, &bString); [...] > free(aString); > free(bStrin

Re: Converting C++ array into Python

2005-10-12 Thread Larry Bates
Like others, without more information on what you have tried we are just guessing. Many times I've used the struct.unpack() module to unpack C "arrays" into python objects. Don't know if this will help, but thought I'd pass it along. Post some code and we can help more. -Larry Bates Adriaan Re

Re: Windows memory pointers in Python?

2005-10-12 Thread Gregory Piñero
Well, I think I've got it after a bit of research: c_char_p(address) seems to do the trick.  Thus it would be: ctypes.c_char_p(address) Of course  still let me know if this is somehow WRONG, or if there is a better way, but this seems good.  Thanks again ctypes!  http://starship.python.net/crew/t

Re: Listen for directory events

2005-10-12 Thread Larry Bates
Googling for "python watch for directory changes" turns these links: http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178 http://www.amk.ca/python/simple/dirwatch.html One of those should help you out.

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
thanks for the tip, however even when I do not free aString or bString, i'm still crashing at the malloc in the c function, not the wrapper. Bernhard Herzog wrote: > "Java and Swing" <[EMAIL PROTECTED]> writes: > > > static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { > [...] > >

RE: Listen for directory events

2005-10-12 Thread Tim Golden
[Bell, Kevin] | Anyone have any advice on listening for directory events? Would this be of any use? http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html TJG This e-mail has been scanned fo

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Bernhard Herzog
"Java and Swing" <[EMAIL PROTECTED]> writes: > thanks for the tip, however even when I do not free aString or bString, > i'm still crashing at the malloc in the c function, not the wrapper. Do you have any more places where you use free incorrectly? In my experience, calling free with invalid va

slots? SLOTS?

2005-10-12 Thread tin gherdanarra
Dear pythonista, what is a "slot" in python? I stumbled over it in several meta-reflection discussions and hard-core developer talk, but found no mention of it in the language reference. Google coughs up more interesting banter about it, but no specifics. Is it a feature that was once planned (fo

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Java and Swing
As far as my C Wrapper functions are concerned...I no longer have the need for free(...). I do use PyMem_Free, for structures I allocated by using PyMem_New(...). In my C code I do have things such as... char *foo(const char *in) { char *tmp; tmp = (char *) malloc((strlen(in) * sizeof(ch

Scope problem with nested functions.

2005-10-12 Thread AddisonN
I'm having trouble resolving a scope problem. I have a module, called from another script, with this structure:   def parseFile(file, myLocation, defaults): # initialisation. ccyMappings = {}   def getCcyMappings()   global ccyMappings   # read values into

Re: Python's garbage collection was Re: Python reliability

2005-10-12 Thread Jorgen Grahn
On Mon, 10 Oct 2005 20:37:03 +0100, Tom Anderson <[EMAIL PROTECTED]> wrote: > On Mon, 10 Oct 2005, it was written: ... >> There is no way you can avoid making garbage. Python conses everything, >> even integers (small positive ones are cached). > > So python doesn't use the old SmallTalk 80 Small

Re: slots? SLOTS?

2005-10-12 Thread Simon Brunning
On 12/10/05, tin gherdanarra <[EMAIL PROTECTED]> wrote: > what is a "slot" in python? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list

Re: C Wrapper Function, crashing Python?

2005-10-12 Thread Bernhard Herzog
"Java and Swing" <[EMAIL PROTECTED]> writes: > char *foo(const char *in) { > char *tmp; > tmp = (char *) malloc((strlen(in) * sizeof(char)) + 1); > strcpy(tmp, in); > ... > ... > free(tmp); > return someValue; > } > > Is that appropriate? I was under the impression tha

  1   2   3   >