Re: module: zipfile.writestr - line endings issue

2007-08-15 Thread Suresh Babu Kolla
Paul Carter wrote: On Aug 14, 1:32 pm, towers [EMAIL PROTECTED] wrote: Thanks - your code works for me also. But I still get the issue when I read the file directly and add it to the archive. Say if I: 1. Use the test.csv file created with your code - currently the line endings look good

What does rany text mean ?

2007-08-15 Thread Alexander Eisenhuth
... as you can find in os.py at line 1 ? Regards Alexander -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast kNN from python

2007-08-15 Thread Janto Dreijer
On Aug 14, 9:27 pm, Sean Davis [EMAIL PROTECTED] wrote: On Aug 14, 6:16 am, Janto Dreijer [EMAIL PROTECTED] wrote: Hi! I am looking for a Python implementation or bindings to a library that can quickly find k-Nearest Neighbors given an arbitrary distance metric between objects.

Re: module: zipfile.writestr - line endings issue

2007-08-15 Thread towers
Please don't top post. The problem is with how you are opening the file. You need to open in binary mode if you wish to read your file unaltered. Also, file() is preferred over open() these days I think. Use: dfile = file('test.csv', 'rb') From Python 2.5 library documentation.

Re: curses library

2007-08-15 Thread Michael Bentley
On Aug 14, 2007, at 11:10 AM, Ghirai wrote: I need to write a console application. Are there any wrappers around curses/ncurses? Or any other similar libraries? It looks like Curses Tk still exists: http://www.schwartzcomputer.com/ tcl-tk/tcl-tk.html It probably requires a recompile of Tk

Re: What does rany text mean ?

2007-08-15 Thread Bjoern Schliessmann
Alexander Eisenhuth wrote: ... as you can find in os.py at line 1 ? Please don't split your request between subject and body. String literals enclosed in triple quotes are multiline strings. String literals prefixed by r are raw strings. http://docs.python.org/ref/strings.html Regards,

Re: What does rany text mean ?

2007-08-15 Thread Claudio Corrodi
Hi Alexander, Alexander Eisenhuth wrote: ... as you can find in os.py at line 1 ? This is a raw string. Raw strings don't interpret the escape sequences. Try this: print 'a\nb\tc' a b c print r'a\nb\tc' a\nb\tc You needn't use the raw string for printing the backslashes. You can escape

moving files in a seperate thread (and/or with progress?)

2007-08-15 Thread Jorgen Bodde
Hi all, I want to make a small batch copy tool that scans for certain files, and copies them to a specified directory. Since the files are huge (AVI / DIVX) typical 300 to 700 Mb, I want to provide the user with some feedback during the file copy. Here is my dillemma; When I use

Re: JPype - passing to Java main

2007-08-15 Thread Gary Duzan
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Good point Laurent. Here is the error produced when I try to access main() using 'com.JPypeTest.main(arg)' The original code is pasted at the top of this thread. I only added 'com.JPypeTest.main(arg)' which causes the error below

access error

2007-08-15 Thread Sreerama Veeranna
Hi all, Sometimes, python gets crash by giving access error sometimes doesn’t. Why is this? Regards Sreerama V [ The information contained in this e-mail is confidential and is intended for the named recipient only. If you are not the named recipient, please notify us by telephone on +44

Combinatorial of elements in Python?

2007-08-15 Thread Sebastian Bassi
I have 2 (or more) groups of elements, and I want to get all possible unique combinations from all of them. Is there a build-in method to do it? ADictionary={one:[A,B,C,D],two:[H,I]} I want to have all possible combinations from one and two, that is: AH BI CH DI AI BH CI DH Sounds easy, but is

Re: creating and appending to a dictionary of a list of lists

2007-08-15 Thread Ant
On Aug 15, 3:30 am, [EMAIL PROTECTED] wrote: Hey, I started with this: factByClass = {} ... def update(key, *args): x = factByClass.setdefault(key, [[], [], [], [] ]) for i, v in enumerate(args): x[i].append(v) Is there a better way? Well, the following is perhaps

Re: buggie in else syntax ?

2007-08-15 Thread stef mientki
Thomas Jollans wrote: On Tuesday 14 August 2007, stef mientki wrote: hello, I've the idea that the else syntax is not always handled correctly, or I'm overlooking something. This pieces of code are automatic translation from another language, sometimes it works, sometimes it doesn't

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Jeremy C B Nicoll
Jeremy C B Nicoll [EMAIL PROTECTED] wrote: When I use os.listdir() to return that list of leaf values, I do seem to get them in alphabetical order, A before B before C etc, but the ~-prefixed ones are returned after the Z-prefixed files rather than before the A-ones. Thanks to people who

Re: wxPython before MainLoop

2007-08-15 Thread samwyse
Chris Mellon wrote: On 8/9/07, Heikki Toivonen [EMAIL PROTECTED] wrote: [david] wrote: I'd like to refresh the display before I start the main loop. If your window isn't able to interact with the user, then I'd consider it a splash screen, no matter if it does look exactly like your main

PyCon 2008 - Call for Tutorial Ideas

2007-08-15 Thread Greg Lindstrom
It's hard to believe, but the planning for PyCon 2008 is underway. PyCon, an annual gathering of Python enthusiasts -- nearly 600 in Dallas last year -- will be held in Chicago next March 14-16, with one full pre-conference day, March 13, set aside for tutorials; classes given by Python honchos

Re: buggie in else syntax ?

2007-08-15 Thread Ant
On Aug 15, 9:40 am, stef mientki [EMAIL PROTECTED] wrote: Thomas Jollans wrote: ... else: JSM(230) ; \ if b3: == SYNTAX ERROR pointing to the f of if This is equivalent to: else: JSM(230) ; if b3: If statements (any compund statements in fact such as for

Re: Combinatorial of elements in Python?

2007-08-15 Thread Wildemar Wildenburger
Sebastian Bassi wrote: I have 2 (or more) groups of elements, and I want to get all possible unique combinations from all of them. Is there a build-in method to do it? ADictionary={one:[A,B,C,D],two:[H,I]} I want to have all possible combinations from one and two, that is: AH BI CH DI

Guitar Reviews

2007-08-15 Thread cvezvu
Custom guitar, acoustic guitar, electric guitars, reviews, specifications, pictures, prices, all here! http://pro-guitars.blogspot.com/ Free guitars http://freeguitars.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Combinatorial of elements in Python?

2007-08-15 Thread François Ingelrest
I have 2 (or more) groups of elements, and I want to get all possible unique combinations from all of them. Is there a build-in method to do it? ADictionary={one:[A,B,C,D],two:[H,I]} result = set() for one in ADictionary[one]: ... for two in ADictionary[two]: ...

Re: module: zipfile.writestr - line endings issue

2007-08-15 Thread Paul Carter
On Aug 15, 3:33 am, Suresh Babu Kolla [EMAIL PROTECTED] wrote: Paul Carter wrote: The problem is with how you are opening the file. You need to open in binary mode if you wish to read your file unaltered. Also, file() is preferred over open() these days I think. Use: dfile =

Re: Guitar Reviews

2007-08-15 Thread Dustan
On Aug 15, 7:32 am, [EMAIL PROTECTED] wrote: snip op.mother.speak() Congratulations! You've just given your email address to millions of people across Usenet! What do you have to say for yourself? op.respond() Awww, jeez, why'd y'all have to bring my mother into this? op.mother.speak() You're

Re: Who told str() to round my int()'s!!!

2007-08-15 Thread A.T.Hofkamp
On 2007-08-11, Adam W. [EMAIL PROTECTED] wrote: After a fair amount of troubleshooting of why my lists were coming back a handful of digits short, and the last digit rounded off, I determined the str() function was to blame: foonum 0.0071299720384678782 str(foonum) '0.00712997203847'

ming on win32 anyone ? [help a noob]

2007-08-15 Thread daz.diamond
hoping someone can help ... how do I install ming (with python) on win32? have downloaded the tar.gz of ming-0.3.0 which doesn't have a handy self-installer, and I'm absolutely foxed as to what to do next ... the install instructions in the package seem to be linux oriented, which to me may as

Re: PyCon 2008 - Call for Tutorial Ideas

2007-08-15 Thread Jeff McNeil
Now, I'm not sure if this has been covered in great detail anywhere, but I'd love to see something touching on interoperability with .Net web services. I've had a lot of success getting Python moved into our organization, but this is where it gets difficult. While I'm product focused, our

Re: Combinatorial of elements in Python?

2007-08-15 Thread Sean Tierney
Hi Team, I'm trying to get Python hooked up to MySQL using MySQL-python-1.2.2 Details: Mac OS X 10.4.x Python2.5 MySQL 5.x.x MySQL-python-1.2.2 gcc Target: i686-apple-darwin8 Configured with: /private/var/tmp/gcc/gcc-5250.obj~12/src/configure --disable-checking -enable-werror --prefix=/usr

Re: creating and appending to a dictionary of a list of lists

2007-08-15 Thread pyscottishguy
On Aug 15, 8:08 am, Ant [EMAIL PROTECTED] wrote: On Aug 15, 3:30 am, [EMAIL PROTECTED] wrote: Hey, I started with this: factByClass = {} ... def update(key, *args): x = factByClass.setdefault(key, [[], [], [], [] ]) for i, v in enumerate(args): x[i].append(v)

Re: Retry: Question about FutureWarning

2007-08-15 Thread Paul McGuire
On Aug 14, 8:49 pm, Erik Max Francis [EMAIL PROTECTED] wrote: Steven W. Orr wrote: M1.py:268: FutureWarning: hex/oct constants sys.maxint will return positive values in Python 2.4 and up StartTime = safe_dict_get ( dic, 'starttime', 0x ) ... import warnings

Re: Combinatorial of elements in Python?

2007-08-15 Thread Mikael Olofsson
Sebastian Bassi wrote: I have 2 (or more) groups of elements, and I want to get all possible unique combinations from all of them. Is there a build-in method to do it? ADictionary={one:[A,B,C,D],two:[H,I]} I want to have all possible combinations from one and two, that is: [snip] Not at

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Marc 'BlackJack' Rintsch
On Wed, 15 Aug 2007 12:34:27 +0100, Jeremy C B Nicoll wrote: I've some supplementary questions... my original code was looking at each leafname in turn via for leaf in os.listdir(path): wholefile = os.path.join(path,leaf) if os.path.isfile(wholefile): if

Re: wxPython before MainLoop

2007-08-15 Thread Chris Mellon
On 8/15/07, samwyse [EMAIL PROTECTED] wrote: Chris Mellon wrote: On 8/9/07, Heikki Toivonen [EMAIL PROTECTED] wrote: [david] wrote: I'd like to refresh the display before I start the main loop. If your window isn't able to interact with the user, then I'd consider it a splash screen,

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Jeremy C B Nicoll
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 15 Aug 2007 12:34:27 +0100, Jeremy C B Nicoll wrote: I've some supplementary questions... my original code was looking at each leafname in turn via for leaf in os.listdir(path): wholefile = os.path.join(path,leaf)

Re: Combinatorial of elements in Python?

2007-08-15 Thread Sebastian Bassi
On 8/15/07, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Oh but it is: ADictionary={one:[A,B,C,D],two:[H,I]} result = set() for one in ADictionary[one]: ... for two in ADictionary[two]: ... result.add(one + two) That was easy :) What about extending it for N elements inside

Using python for dynamic behavior from C++

2007-08-15 Thread Jorgen Bodde
Hi all, I am looking into using Python to introduce dynamic behavior in my C++, e.g. something like a simulation where objects can interact with eachother. I know Python can be called from C++, but is it possible to call a binary compiled Python file / array from C++ ? The reason I ask is that if

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Jon Clements
To emulate the order of XP, you might be able to get away with something like:- sorted( myData, key=lambda L: L.replace('~',chr(0)) ) That just forces all '~'s to be before everything else. hth, Jon. On 15 Aug, 14:33, Jeremy C B Nicoll [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch

Re: make images with python

2007-08-15 Thread Boris Borcic
Lawrence Oluyede wrote: stefano [EMAIL PROTECTED] wrote: I need make some images using python but i'm lost :P http://www.pythonware.com/products/pil/ If you want to do antialiased drawings into images, you might rather want to look for pil at http://effbot.org/downloads/ and grab PIL

encrypting files + filestreams?

2007-08-15 Thread per9000
Hi python people, I am trying to figure out the best way to encrypt files in python. I've build a small script (see below) that encrypts the ubuntu 7.04 iso file in 2 minutes (I like python :) ). But I have some thoughts about it. By pure luck (?) this file happened to be N*512 bytes long so I

Re: Simple python iteration question

2007-08-15 Thread Cameron Laird
In article [EMAIL PROTECTED], Shawn Milochik [EMAIL PROTECTED] wrote: . . . Just for my own sanity: Isn't this the third response advocating the use of enumerate()? Did the other responses not get through, or was this a

Re: Retry: Question about FutureWarning

2007-08-15 Thread A.T.Hofkamp
On 2007-08-15, Paul McGuire [EMAIL PROTECTED] wrote: On Aug 14, 8:49 pm, Erik Max Francis [EMAIL PROTECTED] wrote: So if by '0x' you meant -1, then change this line to use -1. Otherwise, if you really meant 4294967295L, leave it at 0x and move on. A third option is to specify

Re: Using python for dynamic behavior from C++

2007-08-15 Thread A.T.Hofkamp
On 2007-08-15, Jorgen Bodde [EMAIL PROTECTED] wrote: Hi all, I am looking into using Python to introduce dynamic behavior in my C++, e.g. something like a simulation where objects can interact with eachother. I know Python can be called from C++, but is it possible to call a binary compiled

Free Air Conditioners!!!!!

2007-08-15 Thread Lepi Duja
Air conditioning http://airconditionerslinks.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Miles
On 8/15/07, Jeremy C B Nicoll wrote: Marc 'BlackJack' Rintsch wrote: How would I sort leaflist in a way that mimics the sort order that XP shows me things under? This depends on what XP is. Which program? Which locale? How does the locale influence that programs sorting? Well...

Re: Retry: Question about FutureWarning

2007-08-15 Thread Steven W. Orr
Thanks guys, but that's not my question. The question is this: Why does the call to filterwarnings not work if it's placed inside the M1 module? Why do I have to place the call in M4 to make it work? This is more a question about how import works than it is about what the value of -1 is. ;-)

Re: Free Air Conditioners!!!!!

2007-08-15 Thread Paul Heslop
Lepi Duja wrote: Air conditioning posting this crap under different names doesn't make it any more on topic or make it any more likely we'll follow the link -- Paul (We won't die of devotion) --- Stop and Look

Re: Using python for dynamic behavior from C++

2007-08-15 Thread [EMAIL PROTECTED]
On Aug 15, 8:35 am, Jorgen Bodde [EMAIL PROTECTED] wrote: Hi all, I am looking into using Python to introduce dynamic behavior in my C++, e.g. something like a simulation where objects can interact with eachother. I know Python can be called from C++, but is it possible to call a binary

Re: [Tutor] Python Book Recommendations

2007-08-15 Thread Shawn Milochik
If I could have only one book, I would buy Core Python, Second Edition, by Wesley Chun. For the record, I own: Core Python, Second Edition (great) wxPython in Action (haven't used yet) Beginning Python (barely used) Python in a Nutshell (use as a reference, although interactive python dir() is

Re: ming on win32 anyone ? [help a noob]

2007-08-15 Thread [EMAIL PROTECTED]
On Aug 15, 8:03 am, daz.diamond [EMAIL PROTECTED] wrote: hoping someone can help ... how do I install ming (with python) on win32? have downloaded the tar.gz of ming-0.3.0 which doesn't have a handy self-installer, and I'm absolutely foxed as to what to do next ... the install instructions in

Re: FM synthesis using Numpy

2007-08-15 Thread Bas
You got your math wrong. What you are calculating is: sin(2*pi*(1000+15*sin(2*pi*6*t))*t) = sin(2*pi*1000*t + 2*pi*15*sin(2*pi*6*t)*t) The 'instantaneous frequency' can be calculated by differentiating the argument of the sine and dividing by 2pi: x = sin(phi(t)) - f_inst = d (phi(t)) / dt /

Re: ming on win32 anyone ? [help a noob]

2007-08-15 Thread kyosohma
On Aug 15, 9:46 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 15, 8:03 am, daz.diamond [EMAIL PROTECTED] wrote: hoping someone can help ... how do I install ming (with python) on win32? have downloaded the tar.gz of ming-0.3.0 which doesn't have a handy self-installer, and I'm

Re: Combinatorial of elements in Python?

2007-08-15 Thread Thomas Nelson
On Aug 15, 8:39 am, Sebastian Bassi [EMAIL PROTECTED] wrote: That was easy :) What about extending it for N elements inside the dictionary? Sounds like a work for a recursive function. Here's my attempt: [code] def backtrack(groups,position=0, answer=''): if position==len(groups):

Re: Opinions about this new Python book?

2007-08-15 Thread kyosohma
On Aug 14, 1:43 pm, [EMAIL PROTECTED] wrote: On Aug 14, 12:46 pm, Shawn Milochik [EMAIL PROTECTED] wrote: Yes, please post back to the list. I saw this book on Amazon, but there's no table of contents listed, nor is there one on the publisher's site. Thanks, Shawn On 8/14/07,

Python, Sharepoint, .NET, NTLM

2007-08-15 Thread frikk
Hey everyone, I need to authenticate with a Sharepoint server. It looks to be using 'NTLM' authentication. I've looked on the newsgroup and it looks like there has been talk of using python and NTLM but no definite solutions are apparent. Can anyone provide me with any kind of help on this

Re: Memory leak when creating lots of object

2007-08-15 Thread Paul Moore
On 14 Aug, 05:57, Godzilla [EMAIL PROTECTED] wrote: Hello, I have a program that create and pop an object off a queue, but it is experiencing some memory leakage. I have been unable to detect where the memory leakage occur. The strange thing is when i replace the object creation with a plain

Re: Python Book Recommendations

2007-08-15 Thread Azazello
On Aug 15, 7:47 am, Shawn Milochik [EMAIL PROTECTED] wrote: If I could have only one book, I would buy Core Python, Second Edition, by Wesley Chun. For the record, I own: Core Python, Second Edition (great) wxPython in Action (haven't used yet) Beginning Python (barely used) Python in a

Re: Python Book Recommendations

2007-08-15 Thread kyosohma
On Aug 15, 10:30 am, Azazello [EMAIL PROTECTED] wrote: On Aug 15, 7:47 am, Shawn Milochik [EMAIL PROTECTED] wrote: If I could have only one book, I would buy Core Python, Second Edition, by Wesley Chun. For the record, I own: Core Python, Second Edition (great) wxPython in Action

closing StringIO objects

2007-08-15 Thread Neil Cerutti
The documentation says the following about StringIO.close: close( ) Free the memory buffer. Or else... what? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Opinions about this new Python book?

2007-08-15 Thread Neil Cerutti
On 2007-08-15, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: For some reason, the author makes the claim that the term Predicate is bandied about quite a bit in the literature of Python. I have 17 or so Python books and I don't think I've ever seen this used in conjunction with Python...or in any

Re: Python, Sharepoint, .NET, NTLM

2007-08-15 Thread kyosohma
On Aug 15, 10:11 am, frikk [EMAIL PROTECTED] wrote: Hey everyone, I need to authenticate with a Sharepoint server. It looks to be using 'NTLM' authentication. I've looked on the newsgroup and it looks like there has been talk of using python and NTLM but no definite solutions are apparent.

Re: closing StringIO objects

2007-08-15 Thread Alex Martelli
Neil Cerutti [EMAIL PROTECTED] wrote: The documentation says the following about StringIO.close: close( ) Free the memory buffer. Or else... what? Or else the memory buffer sticks around, so you can keep calling getvalue as needed. I believe the freeing will happen anyway,

sub-classing the types in the builtin module datetime

2007-08-15 Thread Colin J. Williams
I wish to sub-class (if that's the right word) datetime and to use a different signature for the constructor. The second part has gone smoothly, but it is difficult to access the type's methods from the sub-class instance. I'm beginning to wonder whether it might might be simpler to write my

Re: Simple python iteration question

2007-08-15 Thread BartlebyScrivener
On Aug 14, 11:59 am, Shawn Milochik [EMAIL PROTECTED] wrote: Just for my own sanity: Isn't this the third response advocating the use of enumerate()? Did the other responses not get through, or was this a time-delay thing? Thanks, Shawn Look at the timestamps. All within ten minutes. And

Re: moving files in a seperate thread (and/or with progress?)

2007-08-15 Thread kyosohma
On Aug 15, 4:28 am, Jorgen Bodde [EMAIL PROTECTED] wrote: Hi all, I want to make a small batch copy tool that scans for certain files, and copies them to a specified directory. Since the files are huge (AVI / DIVX) typical 300 to 700 Mb, I want to provide the user with some feedback during

Re: Opinions about this new Python book?

2007-08-15 Thread Alex Martelli
Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-08-15, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: For some reason, the author makes the claim that the term Predicate is bandied about quite a bit in the literature of Python. I have 17 or so Python books and I don't think I've ever seen this

Re: closing StringIO objects

2007-08-15 Thread Neil Cerutti
On 2007-08-15, Alex Martelli [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote: The documentation says the following about StringIO.close: close( ) Free the memory buffer. Or else... what? Or else the memory buffer sticks around, so you can keep calling getvalue as

All names in the current module

2007-08-15 Thread Torsten Bronger
Hallöchen! How can I get a list with all classes defined in the current module? Thank you! Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus Jabber ID: [EMAIL PROTECTED] (See http://ime.webhop.org for ICQ, MSN, etc.) --

Re: Python Book Recommendations

2007-08-15 Thread vasudevram
On Aug 15, 8:34 pm, [EMAIL PROTECTED] wrote: On Aug 15, 10:30 am, Azazello [EMAIL PROTECTED] wrote: On Aug 15, 7:47 am, Shawn Milochik [EMAIL PROTECTED] wrote: If I could have only one book, I would buy Core Python, Second Edition, by Wesley Chun. For the record, I own: Core

Re: Guitar Reviews

2007-08-15 Thread Steve Holden
Dustan wrote: On Aug 15, 7:32 am, [EMAIL PROTECTED] wrote: snip op.mother.speak() Congratulations! You've just given your email address to millions of people across Usenet! What do you have to say for yourself? Probably something along the lines of that's OK, it's disposable so I don't

Re: ctypes windll question

2007-08-15 Thread sturlamolden
On Aug 14, 11:45 am, Tzury [EMAIL PROTECTED] wrote: I followed the tutorial about ctypes and I still cannot figure out how to call a method of a calss within the dll. ctypes interfaces with C, not C++. C++ compilers do various forms of name manging, create virtual tables, etc. that are

Re: Simple python iteration question

2007-08-15 Thread Gabriel Genellina
En Wed, 15 Aug 2007 10:37:16 -0300, Cameron Laird [EMAIL PROTECTED] escribi�: Shawn Milochik [EMAIL PROTECTED] wrote: Just for my own sanity: Isn't this the third response advocating the use of enumerate()? Did the other responses not get through, or was this a time-delay thing? Yes, for a

how to convert a c program to java program

2007-08-15 Thread Fred Shu (fshu)
I heard I need to port C program to JPython first and compile it to native JAVA. I don't know anything about JPython. Is there a tool to do the porting? If not, what is the quickest way to learn JPython? Thanks, Fred -- http://mail.python.org/mailman/listinfo/python-list

Move files/directories to Recycle Bin using standard Python libs

2007-08-15 Thread Kevin D.Smith
I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be installed. I'm working on a plugin for an existing project and only have the standard library to work

Re: Combinatorial of elements in Python?

2007-08-15 Thread Mikael Olofsson
Sebastian Bassi wrote: Hello, could you do it for an indefinite number of elements? You did it for a fixed (2) number of elements. I wonder if this could be done for all members in a dictionary. What is unclear here is in what order the keys should be visited. The following assumes that the

Re: All names in the current module

2007-08-15 Thread Lawrence Oluyede
Torsten Bronger [EMAIL PROTECTED] wrote: How can I get a list with all classes defined in the current module? Thank you! [EMAIL PROTECTED] ~ % cat t.py class A: pass [EMAIL PROTECTED] ~ % python Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on

Re: Combinatorial of elements in Python?

2007-08-15 Thread Sebastian Bassi
On 8/15/07, Mikael Olofsson [EMAIL PROTECTED] wrote: What is unclear here is in what order the keys should be visited. The following assumes that the keys should be considered in alphanumeric order. Yes, my fault. The orden should be given by a string, like: DCDBA Using this dictionay.

Re: ming on win32 anyone ? [help a noob]

2007-08-15 Thread Thomas Heller
daz.diamond schrieb: hoping someone can help ... how do I install ming (with python) on win32? have downloaded the tar.gz of ming-0.3.0 which doesn't have a handy self-installer, and I'm absolutely foxed as to what to do next ... the install instructions in the package seem to be linux

Importing DLLs

2007-08-15 Thread Corbitt, Kyle
I'm running Linux with Python 2.3. I have a C shared object file (*.so) and I need to be able to call its functions from within Python. I have found a couple of Python modules that allow me to do this (dl, ctypes) but unfortunately I am only able to get them to return integers, even for

Re: Python Book Recommendations

2007-08-15 Thread Beliavsky
On Aug 15, 10:47 am, Shawn Milochik [EMAIL PROTECTED] wrote: If I could have only one book, I would buy Core Python, Second Edition, by Wesley Chun. I have bought about half a dozen Python books but will purchase only Python 3 books in the future, when they become available. I wonder when that

Re: Move files/directories to Recycle Bin using standard Python libs

2007-08-15 Thread kyosohma
On Aug 15, 11:39 am, Kevin D. Smith [EMAIL PROTECTED] wrote: I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be installed. I'm working on a plugin for an

Variable variable name or variable lvalue

2007-08-15 Thread mfglinux
Hello to everybody I would like to know how to declare in python a variable name that it is in turn a variable In bash shell I would wrote sthg like: for x in `seq 1 3` do M$i=Material(x) #Material is a python class done Why I need this? Cause I have a python module that obliges me to build

Re: sub-classing the types in the builtin module datetime

2007-08-15 Thread Michael Amrhein
Colin J. Williams wrote: I wish to sub-class (if that's the right word) datetime and to use a different signature for the constructor. The second part has gone smoothly, but it is difficult to access the type's methods from the sub-class instance. What's difficult? from datetime import

Re: sub-classing the types in the builtin module datetime

2007-08-15 Thread Jay Loden
Colin J. Williams wrote: I wish to sub-class (if that's the right word) datetime and to use a different signature for the constructor. The second part has gone smoothly, but it is difficult to access the type's methods from the sub-class instance. I'm beginning to wonder whether it

Re: ming on win32 anyone ? [help a noob]

2007-08-15 Thread daz.diamond
[EMAIL PROTECTED] wrote: On Aug 15, 9:46 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Aug 15, 8:03 am, daz.diamond [EMAIL PROTECTED] wrote: hoping someone can help ... how do I install ming (with python) on win32? have downloaded the tar.gz of ming-0.3.0 which doesn't have a handy

Re: All names in the current module

2007-08-15 Thread Fabio Z Tessitore
Il Wed, 15 Aug 2007 19:01:17 +0200, Lawrence Oluyede ha scritto: Torsten Bronger [EMAIL PROTECTED] wrote: How can I get a list with all classes defined in the current module? Thank you! [EMAIL PROTECTED] ~ % cat t.py class A: pass [EMAIL PROTECTED] ~ % python Python 2.5.1 (r251:54869,

Re: Hijack! Different book: (was: Opinions about this new Python book?

2007-08-15 Thread kyosohma
On Aug 15, 12:52 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 15 Aug 2007 08:32:30 -0700, [EMAIL PROTECTED] declaimed the following in comp.lang.python: More on the subject...the writer is very conversational in tone and it makes for a light read in the first 1 1/2 chapters that

Re: Simple python iteration question

2007-08-15 Thread Roel Schroeven
Dennis Lee Bieber schreef: On Wed, 15 Aug 2007 13:39:57 -0300, Gabriel Genellina [EMAIL PROTECTED] declaimed the following in comp.lang.python: Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway (Andrew S. Tanenbaum, Computer Networks, 1996; maybe

Re: Module imports during object instantiation

2007-08-15 Thread Ritesh Raj Sarraf
Neil Cerutti wrote: Doesn't __init__ get called automatically ? It gets called automatically when you construct an instance of the class in which it's defined. I am a little confused by your statements now. In my earlier posts in the same thread, I gave some code example which was

Layer 2 socket connection

2007-08-15 Thread alisonken1
Hello all - I'm looking at trying to write a python script to connect to a layer 2 bridge (no IP available). Looking at the sockets function, it's not clear if I can connect using only the mac address - it appears to want either a broadcast address or a specific IP address. Can anyone give me a

Re: Module imports during object instantiation

2007-08-15 Thread Neil Cerutti
On 2007-08-15, Ritesh Raj Sarraf [EMAIL PROTECTED] wrote: Neil Cerutti wrote: Doesn't __init__ get called automatically ? It gets called automatically when you construct an instance of the class in which it's defined. I am a little confused by your statements now. In my earlier posts

Re: All names in the current module

2007-08-15 Thread Lawrence Oluyede
Fabio Z Tessitore [EMAIL PROTECTED] wrote: to get names' list you can simply call globals() Not strictly true. globals() returns the current's scope global vars. If you import a module in the current scope globals() won't display the names inside it. -- Lawrence, oluyede.org - neropercaso.it

replacement for string.printable

2007-08-15 Thread John K Masters
From what I have read the string module is obsolete and should not be used but I am working on a project that parses printable files created in a DOS program and creates a web page for each file. I am using the string.printable constant to determine which characters should be kept; the files

Re: encrypting files + filestreams?

2007-08-15 Thread Larry Bates
per9000 wrote: Hi python people, I am trying to figure out the best way to encrypt files in python. I've build a small script (see below) that encrypts the ubuntu 7.04 iso file in 2 minutes (I like python :) ). But I have some thoughts about it. By pure luck (?) this file happened to

Re: Move files/directories to Recycle Bin using standard Python libs

2007-08-15 Thread Chris Mellon
On 8/15/07, Kevin D.Smith [EMAIL PROTECTED] wrote: I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be installed. I'm working on a plugin for an existing

Re: replacement for string.printable

2007-08-15 Thread Marc 'BlackJack' Rintsch
On Wed, 15 Aug 2007 19:56:01 +0100, John K Masters wrote: From what I have read the string module is obsolete and […] The `string` module isn't obsolete. It even contains a more or less recent new addition: `Template`. Only the functions that are also available as methods on `str` are

Re: Layer 2 socket connection

2007-08-15 Thread Martin v. Löwis
I'm looking at trying to write a python script to connect to a layer 2 bridge (no IP available). Looking at the sockets function, it's not clear if I can connect using only the mac address - it appears to want either a broadcast address or a specific IP address. Can anyone give me a clue

Re: All names in the current module

2007-08-15 Thread Ian Clark
Torsten Bronger wrote: Hallöchen! How can I get a list with all classes defined in the current module? Thank you! Tschö, Torsten. Assuming you want to see all classes in the re module: import re help(re) #best way def isclass(cls): ... try: ... return

Re: Simple python iteration question

2007-08-15 Thread Cameron Laird
In article [EMAIL PROTECTED], BartlebyScrivener [EMAIL PROTECTED] wrote: On Aug 14, 11:59 am, Shawn Milochik [EMAIL PROTECTED] wrote: Just for my own sanity: Isn't this the third response advocating the use of enumerate()? Did the other responses not get through, or was this a time-delay

Re: Layer 2 socket connection

2007-08-15 Thread alisonken1
On Aug 15, 12:05 pm, Martin v. Löwis snip If your operating system supports the PF_PACKET protocol family, you can try to use that. Python only wraps the socket interface of the operating system, so if the system's socket implementation has no facility for that, Python cannot expose it to you,

Re: Variable variable name or variable lvalue

2007-08-15 Thread Marc 'BlackJack' Rintsch
On Wed, 15 Aug 2007 10:42:02 -0700, mfglinux wrote: I would like to know how to declare in python a variable name that it is in turn a variable In bash shell I would wrote sthg like: for x in `seq 1 3` do M$i=Material(x) #Material is a python class done You want a dictionary. M =

Re: Variable variable name or variable lvalue

2007-08-15 Thread Larry Bates
mfglinux wrote: Hello to everybody I would like to know how to declare in python a variable name that it is in turn a variable In bash shell I would wrote sthg like: for x in `seq 1 3` do M$i=Material(x) #Material is a python class done Why I need this? Cause I have a python

Re: Module imports during object instantiation

2007-08-15 Thread Ritesh Raj Sarraf
On Aug 15, 11:42 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-08-15, Ritesh Raj Sarraf [EMAIL PROTECTED] wrote: Or am I terribly missing something that you are trying to tell ? I didn't see log = Log() in your example. Sorry for the excursion. Are you sure os.name is 'posix' on your

  1   2   >