Re: exec and CodeObjects

2007-07-20 Thread Gabriel Genellina
En Fri, 20 Jul 2007 12:48:05 -0300, Prepscius, Colin (IT) <[EMAIL PROTECTED]> escribió: > Does anybody know how to pass parameters to 'exec > somefunction.func_code'? > def f1(): > print 'this is f1' > def f2(p): > print 'this is f2, p =', str(p) > exec f1.func_code > THIS RESULTS IN: "

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-20 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > Come on, this is real-time embedded software, > Since when did we restrict ourselves to such an environment? I was under the > impression that this thread is about the merits and capabilities of static > type-checking? One branch of the discussion

Re: Pickled objects over the network

2007-07-20 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote: > Hmm, I suspect I detect the sounds of the square wheel being reinvented. Very helpful, thank you, Steve - Now how about pointing out in which direction the round wheels are kept, and what their monikers are? - Hendrik -- http://mail.python.org/mailma

Re: Permutations with generators

2007-07-20 Thread Pablo Torres
> > list.insert returns None. Thus, except in the one-element case, your > generator is yielding None all the time. > Oh god...silly me. Thank you guys for the help :) P.S I'm dead stubborn, so here's what I did to fix my code: def perm(seq): "Reshuffles the elements of seq in every pos

Re: Permutations with generators

2007-07-20 Thread Paul Rubin
Pablo Torres <[EMAIL PROTECTED]> writes: > def perm(seq): > "Reshuffles the elements of seq in every possible way" > if len(seq) == 1: > yield seq > else: > for p in perm(seq[1:]): > for i in range(len(seq)): >

Re: Permutations with generators

2007-07-20 Thread Dan Bishop
On Jul 21, 12:42 am, Pablo Torres <[EMAIL PROTECTED]> wrote: > Hey guys! > For the last couple of days, I've been fighting a war against > generators and they've beaten the crap out of me several times. What I > want to do is implement one that yields every possible permutation of > a given sequenc

Spam filter?

2007-07-20 Thread Danyelle Gragsone
So, Can mailing lists have its mail filtered? I get more spam via mailing lists than I do in my own inbox. I am not just singling this mailing list. I see it a lot now. Danyelle -- http://mail.python.org/mailman/listinfo/python-list

Re: Permutations with generators

2007-07-20 Thread Pablo Torres
Just a quick P.S: This WOULD NOT work with strings, because of seq.insert() In very other aspect, I'm still lost. -- http://mail.python.org/mailman/listinfo/python-list

Permutations with generators

2007-07-20 Thread Pablo Torres
Hey guys! For the last couple of days, I've been fighting a war against generators and they've beaten the crap out of me several times. What I want to do is implement one that yields every possible permutation of a given sequence (I had lists in mind, but I could swear that this would work on strin

Re: NTLM APS python version 0.98

2007-07-20 Thread Jay Loden
pycraze wrote: > Hi , > > I am working on NTLM (Windows NT Lan Manager )APS > (Authentication Proxy Server ) , to port to C language . the 'wget' utility supports NTLM authentication as of version 1.1.0 or so, you might try just looking at the C source code to wget if you're looking to imp

Re: Pythonic way for missing dict keys

2007-07-20 Thread Carsten Haese
On Sat, 21 Jul 2007 09:22:32 +0530, Rustom Mody wrote > Can someone who knows about python internals throw some light on why > >>> x in dic > is cheaper than > >>> dic.has_key(x) > > ?? I won't claim to know Python internals, but compiling and disassembling the expressions in question reveals the

Re: Pythonic way for missing dict keys

2007-07-20 Thread Rustom Mody
Can someone who knows about python internals throw some light on why >>> x in dic is cheaper than >>> dic.has_key(x) ?? -- http://mail.python.org/mailman/listinfo/python-list

Python in Nashville

2007-07-20 Thread Patrick Altman
Anyone on this group writing Python code in Nashville, TN? -- http://mail.python.org/mailman/listinfo/python-list

Re: converting 64-bit fixed-point to float

2007-07-20 Thread Michael Tobis
It appears to be correct for positive numbers. if conval >= 2**16: conval -= 2**32 would appear to patch things up. It's not very pretty, though. You could at least start with input1 = [c_ushort(item) for item in input] instead of your first 9 lines. mt -- http://mail.python.org/mailman/

◙►FREE Satellite TV on your PC◄◙

2007-07-20 Thread Dan C
Watch Free Satellite TV on your PC or Laptop Instantly Turn your Computer into a Super TV • Watch all your favorite shows on your Computer & TV! • Channels you can’t get any other place in the U.S.A! • Watch from anywhere in the world! • Save 1000's of $$$ over many years on cable and satellite

RE: code packaging

2007-07-20 Thread Ryan Ginstrom
> On Behalf Of Paul Rubin > I'm wondering how other projects go about this. I develop an automated build system from the very beginning. Running the build script: * Creates the API documentation (epydoc) * Creates the help files (extracting some information from the source) * Builds a windows exec

converting 64-bit fixed-point to float

2007-07-20 Thread John Fisher
Hi Group, troubles with converting signed 32.32, little-endian, 2's complement back to floating point. I have been trying to brew it myself. I am running Python 2.5 on a Mac. Here is the C-code I have been trying to leverage: double FPuint8ArrayToFPDouble(uint8 *buffer, int startIndex) { uin

Re: Sorting dict keys

2007-07-20 Thread Steven D'Aprano
On Fri, 20 Jul 2007 15:27:51 -0700, montyphyton wrote: b = a.keys() b.sort() > [1, 2, 3] > > Works fine, but I would really like it if I could somehow do it in one > line. Why? Is the Enter key on your keyboard broken? Is there a global shortage of newline characters that I haven't be

Re: Pythonic way for missing dict keys

2007-07-20 Thread Steven D'Aprano
On Fri, 20 Jul 2007 19:08:57 +, Alex Popescu wrote: > I am wondering what is the most pythonic way of dealing with missing > keys and default values. [snip three versions] Others have already mentioned the collections.defaultdict type, however it seems people have forgotten about the setdef

Re: Sorting dict keys

2007-07-20 Thread Alex Popescu
Miles <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On 7/20/07, Alex Popescu <[EMAIL PROTECTED]> wrote: >> If you just want to iterate over your dict in an ordered manner than >> all you have to do is: >> >> for k in my_dict.keys().sort(): >> # rest of the code > > I think you meant s

Re: Sorting dict keys

2007-07-20 Thread Roberto Bonvallet
On 20 jul, 19:34, [EMAIL PROTECTED] wrote: > copy.copy returns a new object: > > >>> copy.copy(a.keys()) > > [1,2,3] > > Then why doesn't copy.copy(a.keys()).sort() work?? It works, but you don't notice it, because you don't save a reference to the new list. Try this: c = copy.copy(a.keys())

Re: Sorting dict keys

2007-07-20 Thread montyphyton
On 21 srp, 00:47, Duncan Smith <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Consider the following: > > a = {1:2, 3:4, 2:5} > > > Say that i want to get the keys of a, sorted. First thing I tried: > > b = a.keys().sort() > print b > > > None > > > Doesn't work. Probably be

Re: PDF2ODT

2007-07-20 Thread Zentrader
On Jul 17, 12:47 pm, orehon <[EMAIL PROTECTED]> wrote: > Hello, > I need to convert PDF to ODT or PDF to DOC using python! > > I was taking a look > athttp://www.kde-apps.org/content/show.php/show.php?content=18638&vote=... > and this project is outdated. > > So any idea? > > Thank you! I

Re: Sorting dict keys

2007-07-20 Thread Roberto Bonvallet
On 20 jul, 18:50, Alex Popescu <[EMAIL PROTECTED]> wrote: > If you just want to iterate over your dict in an ordered manner than all > you have to do is: > > for k in my_dict.keys().sort(): > # rest of the code sort() returns None, so this code won't work either. -- Roberto Bonvallet -- http:

Re: Sorting dict keys

2007-07-20 Thread Miles
On 7/20/07, Alex Popescu <[EMAIL PROTECTED]> wrote: > If you just want to iterate over your dict in an ordered manner than all > you have to do is: > > for k in my_dict.keys().sort(): > # rest of the code I think you meant sorted(my_dict.keys()), since, as you just pointed out, the sort() method

Re: Weird errors when trying to access a dictionary key

2007-07-20 Thread Ben Finney
[EMAIL PROTECTED] writes: > I have a data structure that looks like this: > [...] > rpt_file.writelines('\t' + [song].keys() + '\t' + [song].values() + '\n') Forms the list [song] twice, attempting to call the 'keys()' method and the 'values()' method of that list in turn... > I get the followin

Re: code packaging

2007-07-20 Thread Ben Finney
Paul Rubin writes: > Is this appropriate? Inappropriate? Do your projects start using > serious packaging and distribution tools very early in development, > before the code is anywhere near usable? Should they? Yes. Test-driven development has taught me that putting

ANN: CharPy, Charlotte, NC Python Group

2007-07-20 Thread Calvin Spealman
I announced the idea earlier, but forgot to mention the state. I started a mailing list, and I want to find who in the area might be interested. Join if you can, even if you don't know you'll stick. We need to see what kind of interest there is in the area. If you are in the area, even if you aren

Re: Sorting dict keys

2007-07-20 Thread Alex Popescu
[EMAIL PROTECTED] wrote in news:1184970471.146819.86280 @r34g2000hsd.googlegroups.com: I am not sure about your scenario, but as you discovered the sort() method is modifying the in place list (and doesn't return a new one). If you just want to iterate over your dict in an ordered manner than al

Re: Sorting dict keys

2007-07-20 Thread Duncan Smith
[EMAIL PROTECTED] wrote: > Consider the following: > a = {1:2, 3:4, 2:5} > > > Say that i want to get the keys of a, sorted. First thing I tried: > > b = a.keys().sort() print b > > None > > Doesn't work. Probably because I am actually trying to sort the keys > of the dictionary

Re: Sorting dict keys

2007-07-20 Thread Will Maier
On Fri, Jul 20, 2007 at 03:27:51PM -0700, [EMAIL PROTECTED] wrote: > Consider the following: > >>> a = {1:2, 3:4, 2:5} > > Say that i want to get the keys of a, sorted. First thing I tried: > > >>> b = a.keys().sort() > >>> print b > None list's sort() method sorts the list _in_place_: >>>

Re: Sorting dict keys

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 15:27:51 -0700, [EMAIL PROTECTED] wrote: >Consider the following: a = {1:2, 3:4, 2:5} > >Say that i want to get the keys of a, sorted. First thing I tried: > b = a.keys().sort() print b >None > >Doesn't work. Probably because I am actually trying to sort the keys

Re: Sorting dict keys

2007-07-20 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Consider the following: a = {1:2, 3:4, 2:5} > > Say that i want to get the keys of a, sorted. First thing I tried: > b = a.keys().sort() print b > None > > Doesn't work. Probably because I am actually trying to sort the keys > of the dictionary without

Sorting dict keys

2007-07-20 Thread montyphyton
Consider the following: >>> a = {1:2, 3:4, 2:5} Say that i want to get the keys of a, sorted. First thing I tried: >>> b = a.keys().sort() >>> print b None Doesn't work. Probably because I am actually trying to sort the keys of the dictionary without copying them first. If that is the case, fin

Re: Interpreting os.lstat()

2007-07-20 Thread Martin v. Löwis
> But it obviously does a lot of other stuff, including formatting > the results of the system call for display. It most decisively does *not* format the results of the system call "for display". Instead, it converts the C data type holding the stat result into a Python data type. That data type

Python Flagged as a Virus by AVG

2007-07-20 Thread James Matthews
I was reading a Microsoft news group and came across this post Got this during a scan of my computer: infected: object C:\hp\bin\python-2.2.3.exe:\comparisons.html result: trojan horse PHP/MPack.B status: infected embedded object inefected: object C:\hp\bin\python-2.2.3.exe What can/should

Re: Pythonic way for missing dict keys

2007-07-20 Thread Alex Popescu
Jakub Stolarski <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Version 1 and 2 do different thing than version 3. The latter doesn't > add value to dict. > > As it was mentioned before, use: > 1 - if you expect that there's no key in dict > 2 - if you expect that there is key in dict >

Re: win32com ppt embedded object numbers reverting back to original numbers

2007-07-20 Thread kyosohma
On Jul 19, 4:33 pm, Lance Hoffmeyer <[EMAIL PROTECTED]> wrote: > Hey all, > > I have a script that takes numbers from XL and inserts them into an embedded > MSGRAPH dataset in PPT. The problem is that when I reopen the modified > document > that has been saved as a new filename and activate the e

Re: code packaging

2007-07-20 Thread Miki
Hello Paul, > I'm now wondering where this type of thing is best addressed in more > general terms. What I usually see happening, in projects I've worked > on and in others, is that developers get the code working on their own > computers, using source control tools and (if we're lucky) tests > d

Re: Images in Tkinter

2007-07-20 Thread kyosohma
On Jul 20, 11:37 am, "Viewer T." <[EMAIL PROTECTED]> wrote: > I wrote a class in which I have to use Tkinter images. When I create > an image object in the class and reference it with the image attribute > of label within the class, it does not dhow the image. It just shows a > blank label that con

Re: Python MAPI

2007-07-20 Thread kyosohma
> > If Process Monitor has an option to save its output as text files / > CSV files (some of the other SysInternals tools do), you might want to > try using (a Windows version) of grep or awk to filter out the > noise .. > > Vasudev Well, I ran Process Monitor with some filters enabled to only wa

Re: Pythonic way for missing dict keys

2007-07-20 Thread Carsten Haese
On Fri, 2007-07-20 at 19:39 +, Alex Popescu wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > > On 2007-07-20, Alex Popescu <[EMAIL PROTECTED]> wrote: > >> Hi all! > >> > >> I am pretty sure this has been asked a couple of times, but I > >> don't seem to find it

Re: Trying to choose between python and java

2007-07-20 Thread James Matthews
You can always use jython. ;) On 7/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Sun, 15 Jul 2007 at 22:28:08 -0700, Alex Martelli wrote: > James T. Dennis <[EMAIL PROTECTED]> wrote: >... > > You can start writing all your code now as: print() --- calling > > the statement as if

Re: Pythonic way for missing dict keys

2007-07-20 Thread Carsten Haese
On Fri, 2007-07-20 at 20:10 +, Alex Popescu wrote: > Carsten Haese <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > > On Fri, 2007-07-20 at 19:08 +, Alex Popescu wrote: > >> Hi all! > >> > > > > > [snip...] > > > > > > This is called "Look before you leap." Note that "if key

Re: Pythonic way for missing dict keys

2007-07-20 Thread Jakub Stolarski
Version 1 and 2 do different thing than version 3. The latter doesn't add value to dict. As it was mentioned before, use: 1 - if you expect that there's no key in dict 2 - if you expect that there is key in dict -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird errors when trying to access a dictionary key

2007-07-20 Thread robinsiebler
Ignore my previous response. :p I figured out what my problem was. I had [song].keys() when I really meant song.keys() and really needed str(song.keys()). I just got a little too bracket happy. :p -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird errors when trying to access a dictionary key

2007-07-20 Thread robinsiebler
> You are converting the dictionary to a list on this line, and lists do > not have keys> rpt_file.writelines('\t' + > [song].keys() \ > How am I converting it to a list? > Note the first line has braces, not brackets so it is a > dictionary. Braces? What 1st line

Re: Pythonic way for missing dict keys

2007-07-20 Thread Alex Popescu
Neil Cerutti <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On 2007-07-20, Alex Popescu <[EMAIL PROTECTED]> wrote: >> Hi all! >> >> I am pretty sure this has been asked a couple of times, but I >> don't seem to find it on the archives (Google seems to have a >> couple of problems lately).

Re: Efficiently removing duplicate rows from a 2-dimensional Numeric array

2007-07-20 Thread Zentrader
On Jul 19, 8:35 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Alex Mont" <[EMAIL PROTECTED]> wrote in message > I have a 2-dimensional Numeric array with the shape (2,N) and I want to > remove all duplicate rows from the array. For example if I start out > with: > [[1,2], > [1,3], > [1,2], > [2,3

Re: Python MAPI

2007-07-20 Thread vasudevram
On Jul 21, 12:28 am, [EMAIL PROTECTED] wrote: > On Jul 20, 1:48 pm, vasudevram <[EMAIL PROTECTED]> wrote: > > > > > > > On Jul 20, 10:57 pm, [EMAIL PROTECTED] wrote: > > > > Hi, > > > > I've been googling all over and can't find any good answers about this > > > problem. I would like to create some

Re: path error

2007-07-20 Thread godavemon
On Jul 20, 11:45 am, godavemon <[EMAIL PROTECTED]> wrote: > On Jul 20, 11:42 am, godavemon <[EMAIL PROTECTED]> wrote: > > > I'm on an intel macbook using OS X 10.4 and for some reason my path is > > being interpreted incorrectly. See the example: > > > [EMAIL PROTECTED] pwd > > /Users/dave/til/jar

Re: Pythonic way for missing dict keys

2007-07-20 Thread Carsten Haese
On Fri, 2007-07-20 at 19:08 +, Alex Popescu wrote: > Hi all! > > I am pretty sure this has been asked a couple of times, but I don't seem > to find it on the archives (Google seems to have a couple of problems > lately). > > I am wondering what is the most pythonic way of dealing with missi

Re: Python MAPI

2007-07-20 Thread kyosohma
On Jul 20, 1:48 pm, vasudevram <[EMAIL PROTECTED]> wrote: > On Jul 20, 10:57 pm, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > I've been googling all over and can't find any good answers about this > > problem. I would like to create some kind of MAPI interface with > > Python such that when I open

Re: Weird errors when trying to access a dictionary key

2007-07-20 Thread Zentrader
> rpt_file.writelines('\t' + [song].keys() \ > + '\t' + > I get the following error: > > Traceback (most recent call last): > AttributeError: 'list' object has no attribute 'keys' All of these messages are correct. The fi

Re: Pythonic way for missing dict keys

2007-07-20 Thread Neil Cerutti
On 2007-07-20, Alex Popescu <[EMAIL PROTECTED]> wrote: > Hi all! > > I am pretty sure this has been asked a couple of times, but I > don't seem to find it on the archives (Google seems to have a > couple of problems lately). > > I am wondering what is the most pythonic way of dealing with missing

Pythonic way for missing dict keys

2007-07-20 Thread Alex Popescu
Hi all! I am pretty sure this has been asked a couple of times, but I don't seem to find it on the archives (Google seems to have a couple of problems lately). I am wondering what is the most pythonic way of dealing with missing keys and default values. According to my readings one can take t

Re: Python MAPI

2007-07-20 Thread vasudevram
On Jul 20, 10:57 pm, [EMAIL PROTECTED] wrote: > Hi, > > I've been googling all over and can't find any good answers about this > problem. I would like to create some kind of MAPI interface with > Python such that when I open Microsoft Word (or another Office > program) and click File, Send To, Mail

Re: path error

2007-07-20 Thread godavemon
On Jul 20, 11:42 am, godavemon <[EMAIL PROTECTED]> wrote: > I'm on an intel macbook using OS X 10.4 and for some reason my path is > being interpreted incorrectly. See the example: > > [EMAIL PROTECTED] pwd > /Users/dave/til/jared <- dirname = jared > [EMAIL PROTECTED] python > ...>>> impo

path error

2007-07-20 Thread godavemon
I'm on an intel macbook using OS X 10.4 and for some reason my path is being interpreted incorrectly. See the example: [EMAIL PROTECTED] pwd /Users/dave/til/jared <- dirname = jared [EMAIL PROTECTED] python ... >>> import os >>> os.path.abspath('') '/Users/dave/til/Jared' <- dirname

Weird errors when trying to access a dictionary key

2007-07-20 Thread robinsiebler
I have a data structure that looks like this: #dates = {'2007': {'25': {'06/23/07': {'aerosmith': [{'sweet emotion': 1}, {'dream on': 2}], # 'Metallica': [{'Fade to Black': 1}, {'Master of Puppets': 1}]}, # 'last_song': [Master of Puppets',

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Steve Holden
Hrvoje Niksic wrote: > alf <[EMAIL PROTECTED]> writes: > >> still would like to find out why it is happening (now FD_CLOEXEC >> narrowed may yahooing/googling searches). While realize that file >> descriptors are shared by forked processes it is still weird why the >> port moves to the child proce

Re: Python C Embedded ! Attribute Error

2007-07-20 Thread Miki
Hello, > I am using the below C code so that i can embed a Python Code and > get input from a python function and use it in C code . > > Below is the C Code [snipped] > I am getting error > > AttributeError: 'module' object has no attribute 'print' > Cannot find function "print" How do

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-20 Thread John Nagle
Paul Rubin wrote: > Kay Schluehr <[EMAIL PROTECTED]> writes: > >>Sure. But knowing that memory is limited doesn't buy you much because >>you achieve an existential proof at best: you can show that the >>program must run out of memory but you have to run the program to know >>where this happens for

Re: Trying to choose between python and java

2007-07-20 Thread rvu44vs02
On Sun, 15 Jul 2007 at 22:28:08 -0700, Alex Martelli wrote: > James T. Dennis <[EMAIL PROTECTED]> wrote: >... > > You can start writing all your code now as: print() --- calling > > the statement as if it were a function. Then you're future Python > > ...except that your output format will

Python MAPI

2007-07-20 Thread kyosohma
Hi, I've been googling all over and can't find any good answers about this problem. I would like to create some kind of MAPI interface with Python such that when I open Microsoft Word (or another Office program) and click File, Send To, Mail Recipient it opens a program I wrote in Python and uses

Re: Images in Tkinter

2007-07-20 Thread Matt McCredie
That code doesn't tell me anything. You are going to have to post a more complete example to get help. Like, enough code so that I can run it and see the same problem. Also, I tried creating the image object outside class but it gives a runtime error saying it is too early to create an image obj

Data type conversion

2007-07-20 Thread ervin ramonllari
Thank you very much, It was a very helpful tool -- http://mail.python.org/mailman/listinfo/python-list

Images in Tkinter

2007-07-20 Thread Viewer T.
I wrote a class in which I have to use Tkinter images. When I create an image object in the class and reference it with the image attribute of label within the class, it does not dhow the image. It just shows a blank label that conforms to the size of the image. My images is a GIF image. My code t

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-20 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > The issue I have with correctness proofs (at least as they were > presented in the 1980s - for all I know the claims may have become > more realistic now) is that the proof of correctness can only relate > to some highly-formal specification so complex tha

Re: Open HTML file in IE

2007-07-20 Thread 7stud
On Jul 19, 11:09 pm, gravey <[EMAIL PROTECTED]> wrote: > The URL looks like this: > > file:///C|/Temp/Google%20Maps/linktothis.htm?lat=45.0&lng=-20.0&zoom=4&type =k > > The Javascript gets the URL from the Javascript location object and > parses it. I'm assuming that the location object has some ki

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Hrvoje Niksic
alf <[EMAIL PROTECTED]> writes: > still would like to find out why it is happening (now FD_CLOEXEC > narrowed may yahooing/googling searches). While realize that file > descriptors are shared by forked processes it is still weird why the > port moves to the child process once parent gets killed. w

Re: Pickled objects over the network

2007-07-20 Thread Walker Lindley
Right, it's just a big problem with pickle because if you do a recv at the wrong time and try to load it with pickle, you'll start getting weird errors down in the pickle module as opposed to just not getting the full string you expected if you were using plaintext strings. This is probably me bei

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Jeff McNeil
The open file descriptor/socket shouldn't "move" between processes when you kill the parent. When os.system forks, anything you've got open in the parent will transfer to the child. Both descriptors reference the same open port. Running the same 'ss' and 'cc' code you've supplied behaves like t

exec and CodeObjects

2007-07-20 Thread Prepscius, Colin (IT)
Does anybody know how to pass parameters to 'exec somefunction.func_code'? def f1(): print 'this is f1' def f2(p): print 'this is f2, p =', str(p) exec f1.func_code THIS RESULTS IN: "this is nf1" WHICH IS NICE exec f2.func_code THIS RESULTS IN: TypeError: f2() takes exactly 1 ar

Re: Pickled objects over the network

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 08:27:13 -0700, Walker Lindley <[EMAIL PROTECTED]> wrote: >It doesn't interface well because the string you end up with often doesn't >fit into a single packet. Therefore you have to add a layer of protocol on >top of it that allows you to check to make sure you have the whole s

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread Jean-Paul Calderone
On Fri, 20 Jul 2007 08:15:39 -0500, alf <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> >> You can avoid this, if you like. Set FD_CLOEXEC on the socket after you >> open it, before you call os.system: >> >> old = fcntl.fcntl(s.fileno(), fcntl.F_GETFD) >> fcntl.fcntl(s.fileno(), fcnt

Python C Embedded ! Attribute Error

2007-07-20 Thread pycraze
Hi , I am using the below C code so that i can embed a Python Code and get input from a python function and use it in C code . Below is the C Code #include int main(int argc, char *argv[]) { PyObject *pName, *pModule, *pDict, *pFunc; PyObject *pArgs, *pValue; int i; if

NTLM APS python version 0.98

2007-07-20 Thread pycraze
Hi , I am working on NTLM (Windows NT Lan Manager )APS (Authentication Proxy Server ) , to port to C language . I am using ethereal to monitor the packets sent between client and server . NTLM is a MS proprietary protocol designed so that will allow authentication only from MS browsers .

Re: Break up list into groups

2007-07-20 Thread Ron Adam
Matimus wrote: > Excellent work! One more modification and I get below 10us/pass: > > def getgroups(seq): > groups = [] > push = groups.append > iseq = iter(xrange(len(seq))) > for start in iseq: > if seq[start] & 0x80: > for stop in iseq: >

Document creation with odfpy

2007-07-20 Thread DarkBlue
Hello I hope here is the right place to ask this: I use the python odfpy library to create and load an odt file , however, spaces in the passed in text are removed. http://opendocumentfellowship.org/development/projects/odfpy python2.4 from odf.opendocument import OpenDocumentText from odf.s

Re: Pickled objects over the network

2007-07-20 Thread Walker Lindley
It doesn't interface well because the string you end up with often doesn't fit into a single packet. Therefore you have to add a layer of protocol on top of it that allows you to check to make sure you have the whole string received before trying to unpickle it. This the case even if you use socke

Re: class C: vs class C(object):

2007-07-20 Thread George Sakkis
On Jul 20, 5:40 am, Bruno Desthuilliers wrote: > Aahz a écrit : > > > In article <[EMAIL PROTECTED]>, > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >> To make a long story short: Python 2.2 introduced a new object model > >> which is more coherent and more powerful than the original one. T

Re: Pickled objects over the network

2007-07-20 Thread Walker Lindley
It is feasible to an extent since loading each builtin object type is handled by a different function. However, as others have pointed out it makes more sense to use a more robust protocol than try to patch pickle. -Walker On 7/20/07, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: Walker Lindl

Need Help

2007-07-20 Thread pycraze
Hi , I am currently working on NTLM (Windows NT Lan Manager) APS (Authentication Proxy Server ) . NTLM is MS own proprietary protocol that will allow successful authentication for only MS browsers . NTLM APS was successfully cracked by Rosmanov and i am working on NTLM APS python pac

Need Help

2007-07-20 Thread pycraze
Hi , I am currently working on NTLM (Windows NT Lan Manager) APS (Authentication Proxy Server ) . NTLM is MS own proprietary protocol that will allow successful authentication for only MS browsers . NTLM APS was successfully cracked by Rosmanov and i am working on NTLM APS python pac

DateTime Differance

2007-07-20 Thread Robert Rawlins - Think Blue
Hello Guys, I've used the eGenix date time module to create two date time objects which I'm now looking to compare like so: If date 1 is more than 5 minutes older than date 2: Do something here... After reading through the egenix documentation I'm still a little confuse

Re: Compatibility of python2.5 with pytohn2.3

2007-07-20 Thread Gabriel Genellina
En Wed, 18 Jul 2007 08:36:24 -0300, Gerhard Häring <[EMAIL PROTECTED]> escribió: > VISHAL KANAUJIA wrote: >> Hi all, >> I am new member of this post. I have a C application which uses >> Python(version 2.3) extensively with SWIG wrappers. I want to upgrade >> the Python to latest version2.5. >>

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-20 Thread Diez B. Roggisch
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> What does that buy you - where is "I'm crashed becaus I ran out of >> memory trying to evade the seventh mig" better than "sorry, you will >> be shot down because I'm not capable of processing more enemie >> fighters - but hey

Re: Pickled objects over the network

2007-07-20 Thread Steve Holden
Hendrik van Rooyen wrote: > Walker Lindley wrote: > >> Right, I could use Pyro, but I don't need RPC, I just wanted an easy way to > send objects across the network. I'm sure >both Pyro and Yami can do that and > I > may end up using one of them. For the initial version pickle will work because

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-20 Thread Steve Holden
John Nagle wrote: > Juergen Erhard wrote: >> On proving programs correct... from my CS study days I distinctly >> remember thinking "sure, you can prove it correct, but you cannot do >> actual useful stuff with it". We might have come a long way since >> then (late 80s :P), but I don't hold out mu

Re: Gmail Error using smtplib

2007-07-20 Thread supercooper
This works for me... def SendEmail(msgType,sender,recipient,subject,message): """ Sends either a log file or a string message in email to recipient. Uses Google smtp server to send the mail. CHANGELOG: 2006-12-7:Set sender, recipient, subject as input variables -

Re: class C: vs class C(object):

2007-07-20 Thread Steven D'Aprano
On Thu, 19 Jul 2007 10:42:54 -0700, Aahz wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >>It isn't wrong to use the old style, but it is deprecated, [...] > > Really? Can you point to some official documentation for this? AFAIK, > new-style classes sti

Re: subprocess (spawned by os.system) inherits open TCP/UDP/IP port

2007-07-20 Thread alf
Jean-Paul Calderone wrote: > > You can avoid this, if you like. Set FD_CLOEXEC on the socket after you > open it, before you call os.system: > > old = fcntl.fcntl(s.fileno(), fcntl.F_GETFD) > fcntl.fcntl(s.fileno(), fcntl.F_SETFD, old | fcntl.FD_CLOEXEC) > thx for responding (I was about to

Re: class C: vs class C(object):

2007-07-20 Thread Hrvoje Niksic
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > In particular, old-style classes are noticeably faster than > new-style classes for some things (I think it was attribute lookup > that surprised me recently, possibly related to the property > stuff...) Can you post an example that we can benchma

Re: Interprocess communication woes

2007-07-20 Thread Murali
On Jul 19, 4:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Murali <[EMAIL PROTECTED]> wrote: > > After some investigation, I found out that this problem had nothing to > > do with my GUI app not getting refreshed and I was able to reproduce > > this problem with normal python scripts. Here

Re: Pickled objects over the network

2007-07-20 Thread Sion Arrowsmith
Rustom Mody <[EMAIL PROTECTED]> wrote: >Since pickle has problems >-- does not interface well with networking In what way does pickle not interface well with networking? Other than, possibly, security issues which you list as a separate problem with it. I've taken a working XML-RPC system and repl

Re: Interpreting os.lstat()

2007-07-20 Thread Sion Arrowsmith
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= <[EMAIL PROTECTED]> wrote: >> (a) Running 'stat' is *not the same* as a system call. >Why do you say that? It is *exactly* the same [ ... ] Maybe if stat were implemented as int main(int argc, char** argv) { struct stat so_what_am_I_supposed_to_do_

Re: Gmail Error using smtplib

2007-07-20 Thread Tim Williams
On 20/07/07, DJ Fadereu <[EMAIL PROTECTED]> wrote: > Hello, can anyone help me with this? What am I doing wrong here? > > (I've changed private info to /xx) > I'm getting an authentication error while using a standard script > Gmail: > --SCRIPT--

Gmail Error using smtplib

2007-07-20 Thread DJ Fadereu
Hello, can anyone help me with this? What am I doing wrong here? (I've changed private info to /xx) I'm getting an authentication error while using a standard script Gmail: --SCRIPT- import smtplib from email.MIMEText import MIMEText ms

Re: How to organize control access to source code ?

2007-07-20 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >>> How can we organize development team with code source control policy, >>> that limit access to some portion of code ? >> The question may be of interest, but I'm afraid I don't understand how >> it relates to Python ??? > >

  1   2   >