Re: VC++ 6.0 and 2.4

2004-12-09 Thread David Fraser
Jive wrote: Theoretically, if I messed around with the 2.4 project until I got it to build under MS VC++ 6.0, would the python.exe play correctly with version 2.4 .pyd extensions? It should play correctly with version 2.4 .pyd extensions that have been built with MS VC++ 6.0. David -- http://mail

Re: Possible to insert variables into regular expressions?

2004-12-09 Thread Craig Ringer
On Fri, 2004-12-10 at 05:51, Chris Lasher wrote: > Thanks for the reply, Steve! That ought to work quite nicely! For some > reason, I hadn't thought of using %-formatting. I probably should have, > but I'm still learning Python and re-learning programming in general. > This helps a lot, so thanks a

VC++ 6.0 and 2.4

2004-12-09 Thread Jive
Theoretically, if I messed around with the 2.4 project until I got it to build under MS VC++ 6.0, would the python.exe play correctly with version 2.4 .pyd extensions? -- http://mail.python.org/mailman/listinfo/python-list

UK Python Conference - 20-23 April 2005 - Call for papers

2004-12-09 Thread Andy Robinson
The UK Python Conference for 2005 will take place at the Randolph Hotel, Oxford on 20-23 April 2005. We hereby invite speakers to submit proposals for talks. About the event === This will once again be held as a track within the ACCU conference. The conference site is here, and more

Re: Calling a C program from a Python Script

2004-12-09 Thread bitshadow
I think jeff gave the most succint advice as to your question. You should consider your problem carefully and decide if that is what you really need. And when in doubt consult the 'documentation.' (http://docs.python.org/ext/ext.html) -- bitshadow ---

Re: Sorting in huge files

2004-12-09 Thread sjmachin
FWIW, the algorithms in early editions [haven't looked at recent ones] are designed for magnetic tapes, not disk. They do still work on disk (treat each tape drive as a file on disc). I had to implement a robust production-quality sort on MS-DOS about 20 years ago, and did it straight out of Knuth'

Re: Parse XML using Python

2004-12-09 Thread Anil
William Park wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > > I wanted to write a script that will read the below file: > > > > > > . > > > > > > > > .. > > > > .. > > > > > > > > .. > > > > .. > > > > .. > > > > . > > . > > > > . > > > > > > > > .. > > > > > > > > .. > > >

Re: Distutils vs. Extension header files

2004-12-09 Thread vincent wehren
Mike Meyer wrote: I've got a package that includes an extension that has a number of header files in the directory with the extension. They are specified as "depends = [...]" in the Extension class. However, Distutils doesn't seem to do anything with them. If I do an sdist, the include files aren't

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Fernando Perez wrote: Anyway, thanks for the discussion, it clarified a few points. Likewise. I hadn't really delved much into the __getslice__ details until you found that quirk. Always good to have a motivator! Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: results of division

2004-12-09 Thread Peter Hansen
Aahz wrote: In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: So, from the sounds of it, you really care about this ^don't rounding operation in the displayed values, in which case the "'%.2f' % value" approach ought to be fine. Right? I think w

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Presumably the numarray code has to do quite a bit of type checking to > perform all these slicings right (and I didn't even show you what > happens when you use another array as an "index"). I'm not necessarily Yes, I know. I haven't switched to numarray because of the

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Terry Reedy wrote: > >> If no __getslice__() is found, a slice object is created instead, and >> passed to __getitem__() instead. > > The overwhelmingl most common case of a simple slice is more efficiently > done by having a separate function since no slice object is created. > a=[1,2,3]

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Carl Banks
Terry Reedy wrote: > The overwhelmingl most common case of a simple slice is more efficiently > done by having a separate function since no slice object is created. Why is __getslice__ deprecated, then? I'm ok with keeping __getslice__ around as an optimization, but if you do that, I don't think

Re: Wrapper objects

2004-12-09 Thread Bengt Richter
On 9 Dec 2004 06:11:41 -0800, [EMAIL PROTECTED] (Egil M?ller) wrote: >Is there any way to create transparent wrapper objects in Python? > >I thought implementing __getattribute__ on either the wrapper class or >its metaclass would do the trick, but it does not work for the built >in operators: > >

Re: Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Ok, that indeed did work. Thanks for your help. "Michael Auerswald" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ok, problem solved, more or less. What happens is that Tcl isnt looking > for the Tix DLL along the python path nor is it looking along the > os.environ path, but

Re: converting html escape sequences to unicode characters

2004-12-09 Thread Kent Johnson
harrelson wrote: I have a list of about 2500 html escape sequences (decimal) that I need to convert to utf-8. Stuff like: 비 행 기 로 보 낼 거 에 요 내 면 금 이 얼 마 지 잠 Anyone know what the decimal is representing? It doesn't seem to equate to a unicode codepoint... In well-formed HTML (!) these should be the

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > http://docs.python.org/ref/sequence-methods.html > __getslice__( self, i, j) > ... > Called to implement evaluation of self[i:j]. > ... > If no __getslice__() is found, a slice object is created instead, and > passe

Re: results of division

2004-12-09 Thread Aahz
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: >Brad Tilley wrote: >> Peter Hansen wrote: >>> The answer is "what are you trying to do?". The others have >>> given options and good advice, but the "right" approach >>> depends on what exactly you are doing. Is this just f

converting html escape sequences to unicode characters

2004-12-09 Thread harrelson
I have a list of about 2500 html escape sequences (decimal) that I need to convert to utf-8. Stuff like: 비 행 기 로 보 낼 거 에 요 내 면 금 이 얼 마 지 잠 Anyone know what the decimal is representing? It doesn't seem to equate to a unicode codepoint... culley -- http://mail.python.org/mailman/listinfo/pytho

Distutils vs. Extension header files

2004-12-09 Thread Mike Meyer
I've got a package that includes an extension that has a number of header files in the directory with the extension. They are specified as "depends = [...]" in the Extension class. However, Distutils doesn't seem to do anything with them. If I do an sdist, the include files aren't added to the tar

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Fernando Perez wrote: I guess that conceptually it just felt natural to me to keep separate methods for dealing with a slice (get many elements out) and other types of indexing, which I tend to think of as 'scalar' indexing. Yeah, I can see that a bit. Ignoring dicts for the moment (and concerning

Re: threading problem

2004-12-09 Thread Steven Bethard
Egor Bolonev wrote: hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' [snip] threading.Thread(target = run, args = (os.path.join('c:\\', path))).start() I believe the args argument to threading.Thread is supposed to b

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Carl Banks wrote: Steven Bethard wrote: Unfortunately, I don't think __getslice__ can be removed from list (and str and tuple) because of backwards compatibility constraints... Wouldn't it work to have __getslice__ call __getitem__? And, since that would be too much of a performance hit, have it

threading problem

2004-12-09 Thread Egor Bolonev
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program import os, os.path, threading, sys def get_all_files(path): """return all files of folder path, scan with subfolders """ if len(path) >

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Carl Banks wrote: As for why list objects still use getslice--they probably shouldn't. I'd file a bug report. I'm not convinced this is actually a bug; it works just like the docs promise: http://docs.python.org/ref/sequence-methods.htm

Re: Python 2.4 Tix failing on Windows XP

2004-12-09 Thread Michael Auerswald
Ok, problem solved, more or less. What happens is that Tcl isnt looking for the Tix DLL along the python path nor is it looking along the os.environ path, but instead it just checks the normal Windows path. So, if your add python24\DLLs to your path the error is gone. Strangely enough the whole

Re: Sorting in huge files

2004-12-09 Thread François Pinard
[Paul] > Thanks! I definitely didn't want to go into any elaborate programming > for this, and the Unix sort is perfect for this. It sorted a tenth of > my data in about 8 min, which is entirely satisfactory to me (assuming > it will take ~ 20 times more to do the whole thing). Your answer > gre

Re: [Newby] Problem with compilation.

2004-12-09 Thread Fredrik Lundh
Mike C. Fletcher wrote: > There is a work-alike cross-platform "fcrypt.py" module which can be used to > replace crypt on > non-unix platforms. Google to find it. (or read earlier posts to this thread) -- http://mail.python.org/mailman/listinfo/python-list

Re: exec'ing functions

2004-12-09 Thread Mel Wilson
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: >Jeff Shannon wrote: >> I was referring to functions which have an internal exec statement, not >> functions which are created entirely within an exec -- i.e., something >> like this: > >Thanks for the clarification. Here's

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Carl Banks
Steven Bethard wrote: > Unfortunately, I don't think __getslice__ can be removed from list (and > str and tuple) because of backwards compatibility constraints... Wouldn't it work to have __getslice__ call __getitem__? And, since that would be too much of a performance hit, have it check whether

Re: Python 2.4 Tix failing on Windows XP

2004-12-09 Thread Michael Auerswald
j vickroy wrote: Could someone tell me what I am doing incorrectly? All I can tell you is that I have the exact same problem (which I did not have with 2.3). Not much of a help, I know... -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: Ice 2.0 released

2004-12-09 Thread Michi Henning
On Thu, 9 Dec 2004, Duncan Grisby wrote: > In article <[EMAIL PROTECTED]>, > Michi Henning <[EMAIL PROTECTED]> wrote: > > [...] > >Instead of compiling the definition, you can write: > > > >Ice.loadSlice("Color.ice") > >import M > > > >print "My favourite color is ", M.Color.blue > >

Re: [Newby] Problem with compilation.

2004-12-09 Thread Mike C. Fletcher
There is a work-alike cross-platform "fcrypt.py" module which can be used to replace crypt on non-unix platforms. Google to find it. HTH, Mike j vickroy wrote: The Python modules documentation indicates crypt is only available on Unix platforms. ... __

How to set condition breakpoints?

2004-12-09 Thread Christopher J. Bottaro
I have a script with a class in it: class Class: def f(x, y): # do something I start up the debugger like this: python /usr/lib/python2.3/pdb.py myscript.py I want to set a conditional breakpoint: b Class.f, x == 1 and y == 2 ...but that doesn't work. How can I do what I

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Fernando Perez wrote: Steven Bethard wrote: Fernando Perez wrote: I was wondering if someone can help me understand why __getslice__ has been deprecated, yet it remains necessary to implement it for simple slices (i:j), while __getitem__ gets called for extended slices (i:j:k). I don't think this i

Re: How can I change the timestamps of directories? (os.utime(), WinXP)

2004-12-09 Thread Matt Gerrans
Are you able change this directories attributes in a command shell or with explorer?If so, have you tried win32file.SetFileAttributes()? -- http://mail.python.org/mailman/listinfo/python-list

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Carl Banks
Fernando Perez wrote: > I was wondering if someone can help me understand why __getslice__ has been > deprecated, yet it remains necessary to implement it for simple slices (i:j), > while __getitem__ gets called for extended slices (i:j:k). > > The problem with this approach, besides a bit of code

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Fernando Perez wrote: >> classes which implement slicing must now do runtime type-checking inside >> __getitem__. > > Just in case you thought that they wouldn't have to do runtime > type-checking otherwise: > > >>> class C(object): > ... def __getitem__(self, x): >

RE: Possible to insert variables into regular expressions?

2004-12-09 Thread Robert Brewer
Chris Lasher wrote: > I would like to create a set of very similar regular expression. In > my initial thought, I'd hoped to create a regular expression with a > variable inside of it that I could simply pass a string into by > defining this variable elsewhere in my module/function/class where I >

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Fernando Perez wrote: >> I was wondering if someone can help me understand why __getslice__ has been >> deprecated, yet it remains necessary to implement it for simple slices >> (i:j), while __getitem__ gets called for extended slices (i:j:k). > > I don't think this is tru

Re: Calling a C program from a Python Script

2004-12-09 Thread Armin Steinhoff
Brad Tilley wrote: Is it possible to write a file open, then read program in C and then call the C program from a Python script like this: for root, files, dirs in os.walk(path) for f in files: try: EXECUTE_C_PROGRAM If possible, how much faster would this be over a pure P

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Carl Banks
Peter Hansen wrote: > In general I would say that mucking with globals() like this is > probably best restricted to constants like in this case, if at all. Modifying globals() not even necessary for this. When I want to dynamically update the global namespace, I do it this way: mod = __import__(

Re: Calling a C program from a Python Script

2004-12-09 Thread Matt Gerrans
"Brad Tilley" <[EMAIL PROTECTED]> wrote: >>>I'm dealing with a terabyte of files. Perhaps I should have mentioned >>>that. I wouldn't automatically assume that recursing the directories with a Python script that calls a C program for each file is faster than doing the processing in Python. Fo

Re: Possible to insert variables into regular expressions?

2004-12-09 Thread Chris Lasher
Thanks for the reply, Steve! That ought to work quite nicely! For some reason, I hadn't thought of using %-formatting. I probably should have, but I'm still learning Python and re-learning programming in general. This helps a lot, so thanks again. Chris -- http://mail.python.org/mailman/listinfo

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Fernando Perez wrote: classes which implement slicing must now do runtime type-checking inside __getitem__. Just in case you thought that they wouldn't have to do runtime type-checking otherwise: >>> class C(object): ... def __getitem__(self, x): ... print type(x), x ... >>> c = C() >

Re: Questions about file object and close()

2004-12-09 Thread John Marshall
On Thu, 2004-12-09 at 10:33 -0500, Peter Hansen wrote: > John Marshall wrote: > > It seems to me that a file.__del__() _should_ > > call a file.close() to make sure that the file > > is closed as a clean up procedure before > > releasing the object. > > I believe it does, but I tried your experim

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Steven Bethard
Fernando Perez wrote: I was wondering if someone can help me understand why __getslice__ has been deprecated, yet it remains necessary to implement it for simple slices (i:j), while __getitem__ gets called for extended slices (i:j:k). I don't think this is true -- everything goes to __getitem__:

Re: Possible to insert variables into regular expressions?

2004-12-09 Thread Steven Bethard
Chris Lasher wrote: I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a string into by defining this variable elsewhere in my module/function/class where I compile th

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Fernando Perez wrote: > Hi all, > > I was wondering if someone can help me understand why __getslice__ has been > deprecated, yet it remains necessary to implement it for simple slices (i:j), > while __getitem__ gets called for extended slices (i:j:k). [...] > def __getitem__(self,key): >

Re: results of division

2004-12-09 Thread Dan Bishop
Brad Tilley wrote: > Hello, > > What is the proper way to limit the results of division to only a few > spaces after the decimal? I don't need rocket-science like precision. > Here's an example: If your only complaint is that it's ugly to display 17 digits, then use the % operator to display how

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Jeff Shannon
Philippe C. Martin wrote: Hi, After all of you answers, I though I had it straight, yet . This is what I am doing: class SC_ISO_7816: __m_loaded = None .. def __init__(self): if SC_ISO_7816.__m_loaded == None: SC_ISO_7816.__m_loaded = True print 'LOADING'

Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Hi all, I was wondering if someone can help me understand why __getslice__ has been deprecated, yet it remains necessary to implement it for simple slices (i:j), while __getitem__ gets called for extended slices (i:j:k). The problem with this approach, besides a bit of code duplication, is that

Possible to insert variables into regular expressions?

2004-12-09 Thread Chris Lasher
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a string into by defining this variable elsewhere in my module/function/class where I compile the regular exp

Re: Directory structure inside a ZipFile object

2004-12-09 Thread Bulba!
On Thu, 09 Dec 2004 07:42:57 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Look into the two-argument form of the write command: Well, I should have guessed that, it works. Thanks! > import zipfile > archive = zipfile.ZipFile('box.zip', 'w', zipfile.ZIP_DEFLATED) > archive.

Re: Calling a C program from a Python Script

2004-12-09 Thread Jeff Shannon
Brad Tilley wrote: I just want to know the basics of using C and Python together when the need arises, that's all, I don't want to write a book about what exactly it is that I'm involved in. Well, there's several different ways of using C and Python together, so the only meaningful answer we ca

Re: Calling a C program from a Python Script

2004-12-09 Thread Caleb Hattingh
Hi Brad Not that I'm an expert but note: 1. If you already know C, fair enough. You should know what you are getting into then. I sure as heck don't know it very well at all and I'm not gonna make that time investment now. MAYBE if I really really needed the extra speed (but this seems to

Re: Ideas for projects

2004-12-09 Thread Jeff Shannon
Caleb Hattingh wrote: Here is something I would try but don't have the guts for: If you could write an extension to idle (yes, idle, not Boa, not Eric, etc) that pops up a small list of possible completions in a listbox when you type a '.' (period) after any object name or module name (includi

Re: [Newby] Problem with compilation.

2004-12-09 Thread j vickroy
The Python modules documentation indicates crypt is only available on Unix platforms. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi folks! > > Can't compile my file due to some problems with crypt module. > My platform is WinXP: > First I launch my Python Shell, > Than I open th

Re: creating generators from function

2004-12-09 Thread Mike Meyer
Isaac To <[EMAIL PROTECTED]> writes: >> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes: > > Mike> I think it's a bit abnormal, because you have to scan the > Mike> loop body for breaks. I tend to write: > > Mike> condition = True > Mike> while condition: # corrected > Mik

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Jeff Shannon
Peter Hansen wrote: The main way I use this is in some sort of a "const" module, which provides access to a large set of constant information. In other words, in contrast to what you had in mind when you wrote the above, I'm dealing with neither "variables" nor information that _would_ best be put

Re: Ideas for projects

2004-12-09 Thread Mike Meyer
"Fuzzyman" <[EMAIL PROTECTED]> writes: > Phillip Bowden wrote: > The first one is an online bookmarks manager. There are various of > these around - but none in python and none as straightforward as I > would like. It would be easy to get something working and then expand > it to do more things (l

Re: Parse XML using Python

2004-12-09 Thread William Park
[EMAIL PROTECTED] wrote: > Hi, > > I wanted to write a script that will read the below file: > > > . > > > > .. > > .. > > > > .. > > .. > > .. > > . > . > > . > > > > .. > > > > .. > > > > > > .. > and so on > > The output of the script shud be > > ABC > ..EFGA >

Re: updating locals() and globals() (WAS: How do I do this? (eval() on the left hand side))

2004-12-09 Thread Bengt Richter
On Wed, 8 Dec 2004 20:22:52 -0500, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >To respond to and summarize several posts in this discussion: > >Within a function, where the local namespace is distinct from the global >(module) namespace, CPython usually implements the local namespace >internally a

Re: [Newby] Problem with compilation.

2004-12-09 Thread rootshell
> > > Can't compile my file due to some problems with crypt module.> > My platform is WinXP:> > http://docs.python.org/lib/module-crypt.html> >     Section 8: Unix Specific Services> >     8.4 crypt -- Function to check Unix passwords> >     Availability: Unix.> > here's a portable crypt i

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Caleb Hattingh
Jeff I do the same thing in Delphi -> prepend "Self" before all the members in class methods even though its not required. I do it partially for the same reason as you - so I can grok which variables are local and which are global (well, global within the class, anyway). The other reason is

Re: Ideas for projects

2004-12-09 Thread Caleb Hattingh
Here is something I would try but don't have the guts for: If you could write an extension to idle (yes, idle, not Boa, not Eric, etc) that pops up a small list of possible completions in a listbox when you type a '.' (period) after any object name or module name (including builtins), that wo

Re: [Newby] Problem with compilation.

2004-12-09 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > Can't compile my file due to some problems with crypt module. > My platform is WinXP: http://docs.python.org/lib/module-crypt.html Section 8: Unix Specific Services 8.4 crypt -- Function to check Unix passwords Availability: Unix. here's a portable cry

Re: results of division

2004-12-09 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Brad Tilley <[EMAIL PROTECTED]> wrote: > > Brad Tilley wrote: > > > >> What is the proper way to limit the results of division to only a few > >> spaces after the decimal? I don't need rocket-science like precision. > >> Here's an example: > >> > >> 1.775 is as e

Re: Calling a C program from a Python Script

2004-12-09 Thread Grant Edwards
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: > I just want to know the basics of using C and Python together > when the need arises, that's all, I don't want to write a book > about what exactly it is that I'm involved in. > > I'm going to take It's Me's advice and have a look at SWIG. T

Re: Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Grant Edwards wrote: On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: Steven Bethard wrote: for root, files, dirs in os.walk(path) for f in files: try: x = file(f, 'rb') data = x.read() x.close() Remember that CPython is implemented in C, and so

Re: Calling a C program from a Python Script

2004-12-09 Thread Grant Edwards
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: > Steven Bethard wrote: for root, files, dirs in os.walk(path) for f in files: try: x = file(f, 'rb') data = x.read() x.close() >> >> >> Remember that CPython i

Re: Calling a C program from a Python Script

2004-12-09 Thread Grant Edwards
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: >> You're going to have to explain clearly what you mean by >> "EXECUTE_C_PROGRAM". If you want to, you can certainly run a >> binary executable that was generated from C source, (e.g. an >> ELF file under Linux or whatever a .exe file is unde

Re: Users

2004-12-09 Thread Peter Hansen
python1 wrote: Do you know of a way to list the users on a Win2K machine? I can't seem to find a module for this. As a starting point, I played a moment and found this: >>> import win32net >>> dir(win32net) ['NetFileClose', 'NetFileEnum', 'NetFileGetInfo', ... 'NetUserEnum', 'NetUserGetGroups', 'N

Re: Users

2004-12-09 Thread python1
Tim Golden wrote: [python1] | Do you know of a way to list the users on a Win2K machine? I | can't seem to find a module for this. Interpretation 1: who is in the user database of a given machine? Sorry for the ambiguity. Yes #1 is correct. I'll try the code you've listed... Thanks. Investigate

[Newby] Problem with compilation.

2004-12-09 Thread rootshell
Hi folks! Can't compile my file due to some problems with crypt module. My platform is WinXP: First I launch my Python Shell, Than I open the *.py file, Next I press F5 to 'run module' The message is:"ImportError: No module named crypt" Few lines of code for example: ... import posix import

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Peter Hansen
Jeff Shannon wrote: Of course, just because modifications of the dict returned by globals() *do* reliably result in modifications to the global namespace, doesn't mean it's a good idea. ;) "The" global namespace misses the possibility that doing this in "a" global namespace might be a good idea.

Re: Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Steven Bethard wrote: for root, files, dirs in os.walk(path) for f in files: try: x = file(f, 'rb') data = x.read() x.close() Remember that CPython is implemented in C, and so all the builtin types (including file) basically execute C code dire

Re: Calling a C program from a Python Script

2004-12-09 Thread Steven Bethard
It's me wrote: I would expect C to run circles around the same operation under Python. You should probably only expect C to run circles around the same operations when those operations implemented entirely in Python. In the specific (trivial) example given, I wouldn't expect Python to be much s

Re: Calling a C program from a Python Script

2004-12-09 Thread Fredrik Lundh
Brad Tilley wrote: > for root, files, dirs in os.walk(path) > for f in files: > try: > EXECUTE_C_PROGRAM http://docs.python.org/lib/module-subprocess.html this module in new in 2.4; for older version, os.system() or the os.popen() family might be what you're looking fo

Re: Calling a C program from a Python Script

2004-12-09 Thread It's me
I would expect C to run circles around the same operation under Python. As a general rule of thumb, you should use C for time cirtical operations (computer time, that is), and use Python for human time critical situations (you can get a program developed much faster). I just discovered a magical

Re: Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Grant Edwards wrote: Huh? What do you mean "write a file open"? You want to read a C source file and execute the C source? If you have access to a C interpreter, I guess you could invoke the interpreter from python using popen, and feed the C source to it. Alternatively you could invoke a compi

Re: Calling a C program from a Python Script

2004-12-09 Thread Istvan Albert
Brad Tilley wrote: If possible, how much faster would this be over a pure Python solution? It is like the difference between Batman and Ever. batman is faster than ever -- http://mail.python.org/mailman/listinfo/python-list

RE: Users

2004-12-09 Thread Tim Golden
[python1] | Do you know of a way to list the users on a Win2K machine? I | can't seem to find a module for this. Interpretation 1: who is in the user database of a given machine? Investigate the win32net module. Something like this: import win32net import win32netcon MACHINE_NAME = 'VOGBP200'

Re: Calling a C program from a Python Script

2004-12-09 Thread Grant Edwards
On 2004-12-09, Brad Tilley <[EMAIL PROTECTED]> wrote: > Is it possible to write a file open, then read program in C and then > call the C program from a Python script like this: Huh? What do you mean "write a file open"? You want to read a C source file and execute the C source? If you have a

Re: ElementTree and XPATH

2004-12-09 Thread Istvan Albert
[EMAIL PROTECTED] wrote: it seems to be invalid syntax if I give "/a/b[0]" to the findall() method. Does anyone know the correct syntax? I think the proper mindset going in should be that elementtree does not support xpath but that there are some handy constructs that resemble the location steps of

Users

2004-12-09 Thread python1
Do you know of a way to list the users on a Win2K machine? I can't seem to find a module for this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Philippe C. Martin
>Well, from the looks of things, you don't seem to understand the >basic idea of instances and instance attributes.  There is a key >difference between SC_ISO_67816.__m_loaded and self.SW1_DICT, >and that is that the former one is seen by *all instances*, while >the latter is an attribute in *only

Calling a C program from a Python Script

2004-12-09 Thread Brad Tilley
Is it possible to write a file open, then read program in C and then call the C program from a Python script like this: for root, files, dirs in os.walk(path) for f in files: try: EXECUTE_C_PROGRAM If possible, how much faster would this be over a pure Python solution? Tha

Re: Creating Fixed Length Records

2004-12-09 Thread Andrew James
Greg, Absolutely *perfect* case for a dose of Python string concatenation performance theory or, How To Join Strings Together Fast: http://www.skymind.com/~ocrow/python_string/ HTH, Andrew On Wed, 2004-12-08 at 17:29 -0600, Greg Lindstrom wrote: > Hello- > > I'm creating fixed-length record lay

Re: results of division

2004-12-09 Thread Christopher A. Craig
"Paul McGuire" <[EMAIL PROTECTED]> writes: > Errr? How come round() is able to understand 1.775 correctly, whereas > string interp is not? I'm guessing that round() adds some small epsilon to > the value to be rounded, or perhaps even does the brute force rounding I > learned in FORTRAN back in

Re: mapping function to vars

2004-12-09 Thread jahurt
Steven Bethard wrote: > [EMAIL PROTECTED] wrote: > > I need to map a function to several variables. I'm trying to use map > > and lambda to do this. Here's my attempt... > > > > #!/usr/bin/env python > > from random import * > > > > [fee, fye, foe, fum] = map(lambda n: random(), range(4)) > > >

Re: Parse XML using Python

2004-12-09 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > > > . > . > > > > .. > and so on an XML document can only have a single root element, but your example has at least two top-level elements (abcd and xyz). here is some elementtree code that handles this by wrapping your data in a "root" element. from elementtr

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Jeff Shannon
Nick Coghlan wrote: Peter Hansen wrote: Nick, could you please comment on why you say this about globals()? I've never heard of any possibility of "unreliability" in updating globals() and, as far as I know, a large body of code exists which does in fact rely on this -- much of mine included. ;-)

Re: Loading a file only once into an object and being able to access it from other modules - still have a problem

2004-12-09 Thread Peter Hansen
Philippe C. Martin wrote: class SC_ISO_7816: __m_loaded = None Please don't use tabs in code you post here. Many newsreaders have trouble displaying them, and make the code look like it does above (i.e. no indentation at all) which makes it hard to understand. .. def __init__(self):

Re: mapping function to vars

2004-12-09 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) print fee print fye print foe print fum ...I'm essentially

Re: mapping function to vars

2004-12-09 Thread Brian Quinlan
[EMAIL PROTECTED] wrote: I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) from random import random fee = random() fye = random() foe

Re: How do I do this? (eval() on the left hand side)

2004-12-09 Thread Bengt Richter
On Tue, 07 Dec 2004 21:12:24 GMT, "It's me" <[EMAIL PROTECTED]> wrote: > >"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Hi It's me >> >> > >> > a = 3 >> > y = "a" >> > print eval(y) >> > >> >> To get 'a' to be 4 here, you would say >> >> a = 4 >> > >O

Re: Upgrading Python Article

2004-12-09 Thread JanC
Fuzzyman schreef: > On the other hand the microsoft > compiler is *better* than gcc anyway :-) It's better at optimising, but it doesn't support standard C & C++. ;-) -- JanC "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.

Re: Sorting in huge files

2004-12-09 Thread Paul
Thanks! I definitely didn't want to go into any elaborate programming for this, and the Unix sort is perfect for this. It sorted a tenth of my data in about 8 min, which is entirely satisfactory to me (assuming it will take ~ 20 times more to do the whole thing). Your answer greatly helped! Paul -

mapping function to vars

2004-12-09 Thread jahurt
I need to map a function to several variables. I'm trying to use map and lambda to do this. Here's my attempt... #!/usr/bin/env python from random import * [fee, fye, foe, fum] = map(lambda n: random(), range(4)) print fee print fye print foe print fum ...I'm essentially trying to map a funct

  1   2   >