Re: Python, HTTPS (SSL), tlslite and metoda POST (and lots of pain)

2009-02-23 Thread Steve Holden
yat...@gmail.com wrote: > Hi there. [...] Yatsek: You just "hijacked a thread" by writing your question as a reply to somebody else's post. Be aware that a lot of newsreaders will show it as a part of this other thread rather than giving if a thread of its own, and so many people (who may have sk

Re: Reference or Value?

2009-02-23 Thread Steve Holden
Denis Kasak wrote: > On Mon, Feb 23, 2009 at 8:41 PM, Christian Heimes wrote: >> Denis Kasak wrote >>> You could, however, argue that the swap function doesn't work as >>> expected (e.g. from a Pascal or a C++ POV) simply because the >>> underlying objects aren't mutable. The objects *do* get pass

Re: "import" not working?

2009-02-23 Thread Lionel
On Feb 23, 11:24 am, Lionel wrote: > On Feb 21, 12:37 am, "Gabriel Genellina" > wrote: > > > > > > > En Fri, 20 Feb 2009 22:40:03 -0200, Lionel   > > escribió: > > > > Okay, moving the wx example into the same directory containing the > > > first example that was working fixed it. This directory

Re: Extending Python Questions .....

2009-02-23 Thread Diez B. Roggisch
Ben schrieb: Ok... Now I can start asking. In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that "imports" your extension. module - and all

Re: Python, HTTPS (SSL), tlslite and metoda POST (and lots of pain)

2009-02-23 Thread Wolfgang Rohdewald
On Montag, 23. Februar 2009, Steve Holden wrote: > yat...@gmail.com wrote: > > Hi there. > [...] > > Yatsek: > > You just "hijacked a thread" by writing your question as a reply to > somebody else's post did he? His mail headers show no reference to any other mail AFAICS -- Wolfgang -- http://

Re: python sql query in django

2009-02-23 Thread Bruno Desthuilliers
May a écrit : I have three tables: Actually - from Python's code POV - three Model classes. And actually, since there's a very active, friendly and helpful django group on googlegroups, you'd be better reposting your question there. (snip Django's ORM related question) -- http://mail.python

Re: Extending Python Questions .....

2009-02-23 Thread Nick Craig-Wood
Ben wrote: > In My S-Lag Project called, SLAG, I have some function keys that get > mapped back to S-lang internal functions. > > My SLAG project works pretty much like Python (as does the S-Lang). > You write a S-lang script > that "imports" your extension. module - and all this gets run by

Need to store dictionary in file

2009-02-23 Thread S.Selvam Siva
Hi all, I have a dictionary in which each key is associated with a list as value. eg: *dic={'a':['aa','ant','all']}* The dictionary contains *1.5 lakh keys*. Now i want to store it to a file,and need to be loaded to python program during execution. I expect your ideas/suggestions. Note:I think

Re: Reference or Value?

2009-02-23 Thread Denis Kasak
On Mon, Feb 23, 2009 at 9:12 PM, Steve Holden wrote: > Denis Kasak wrote: >> I assure you I am not confused about Python's object model / calling >> system. I was arguing, from a purely theoretical standpoint, that the >> same system Python uses could be described in terms of >> call-by-reference

Re: Python C-API Object Allocation

2009-02-23 Thread Philip Semanchuk
On Feb 21, 2009, at 10:01 AM, William Newbery wrote: Ive been learning the C-API lately so I can write python extensions for some of my c++ stuff. I want to use the new and delete operators for creating and destroying my objects. The problem is python seems to break it into several stage

RE: Peculiar swap behavior

2009-02-23 Thread Delaney, Timothy (Tim)
Tim Chase wrote: > # swap list contents...not so much... > >>> m,n = [1,2,3],[4,5,6] > >>> m[:],n[:] = n,m > >>> m,n > ([4, 5, 6], [4, 5, 6]) > > > The first two work as expected but the 3rd seems to leak some > internal abstraction. It seems to work if I force content-copying: > > >>> m[:

Re: python sql query in django

2009-02-23 Thread May
On Feb 23, 11:31 am, Bruno Desthuilliers wrote: > May a écrit : > > > I have three tables: > > Actually - from Python's code POV - three Model classes. And actually, > since there's a very active, friendly and helpful django group on > googlegroups, you'd be better reposting your question there. >

Challenge: Please break this! [Python Security]

2009-02-23 Thread tav
Hey all, As an attempt to convince Python-Dev of the merits of a functions-based approach to security in Python, I've come up with a simple challenge. If enough smart hackers look at this and it holds up, Guido promises to accept a patch which would enable this on both App Engine and future Pytho

Re: Reference or Value?

2009-02-23 Thread Steve Holden
Denis Kasak wrote: > On Mon, Feb 23, 2009 at 9:12 PM, Steve Holden wrote: >> Denis Kasak wrote: >>> I assure you I am not confused about Python's object model / calling >>> system. I was arguing, from a purely theoretical standpoint, that the >>> same system Python uses could be described in terms

Re: Top posting

2009-02-23 Thread D'Arcy J.M. Cain
On Mon, 23 Feb 2009 20:29:42 +0100 Stef Mientki wrote: > I agree that top posting on a message like this is not very convenient, Not convenient for thousands, slightly convenient for you. > but for simple messages ... It is still better to follow the suggestions I posted. Also see http://en.wi

Re: Python, HTTPS (SSL), tlslite and metoda POST (and lots of pain)

2009-02-23 Thread Steve Holden
Wolfgang Rohdewald wrote: > On Montag, 23. Februar 2009, Steve Holden wrote: >> yat...@gmail.com wrote: >>> Hi there. >> [...] >> >> Yatsek: >> >> You just "hijacked a thread" by writing your question as a reply to >> somebody else's post > > did he? His mail headers show no reference to any other

Re: Server programming

2009-02-23 Thread Bruno Desthuilliers
koranthala a écrit : Hi, Is server programming in Python procedure oriented or object oriented? It's how you want it to be. I have this question because lately I am asked to make a medium complex web program (extremely database oriented) using Django. When I used to do application

Re: python sql query in django

2009-02-23 Thread Steve Holden
May wrote: > On Feb 23, 11:31 am, Bruno Desthuilliers > wrote: >> May a écrit : >> >>> I have three tables: >> Actually - from Python's code POV - three Model classes. And actually, >> since there's a very active, friendly and helpful django group on >> googlegroups, you'd be better reposting your

Re: Python AppStore / Marketplace

2009-02-23 Thread Michael Torrie
Steve Holden wrote: > Unfortunately I have no idea what a "souq" is, so I suspect this may be > linguistically biased against English speakers. Or perhaps I'm just > ignorant. Nah. Not biased against English speakers. Just biased against the un-traveled. :) -- http://mail.python.org/mailman/lis

Python, HTTPS (SSL), tlslite and POST method (and lots of pain)

2009-02-23 Thread yatsek
Hi there. Since quite long time I'm trying to achieve following things: - for some sort of testing I need webserver with https access - with POST method implemented I found something which fits it in nicely written in Python, connected my toys and... server hangs in some weird "inter-state" while

Re: Top posting

2009-02-23 Thread Stef Mientki
btw, it's also polite (in some cultures) to sign your messages ;-) Hmm. I appreciate that you took the time to remove my signature from your reply but I don't think that you should then claim that I never included one. Sorry for that. (now you get an idea how difficult it is for me

Re: Python, HTTPS (SSL), tlslite and metoda POST (and lots of pain)

2009-02-23 Thread yatsek
On Feb 23, 9:57 pm, Steve Holden wrote: > Wolfgang Rohdewald wrote: > > On Montag, 23. Februar 2009, Steve Holden wrote: > >> yat...@gmail.com wrote: > >>> Hi there. > >> [...] > > >> Yatsek: > > >> You just "hijacked a thread" by writing your question as a reply to > >> somebody else's post > > >

Re: python sql query in django

2009-02-23 Thread May
On Feb 23, 1:00 pm, Steve Holden wrote: > May wrote: > > On Feb 23, 11:31 am, Bruno Desthuilliers > > wrote: > >> May a écrit : > > >>> I have three tables: > >> Actually - from Python's code POV - three Model classes. And actually, > >> since there's a very active, friendly and helpful django gr

intermediate python csv reader/writer question from a beginner

2009-02-23 Thread Learning Python
anything related to csv, I usually use VB within excel to manipulate the data, nonetheless, i finally got the courage to take a dive into python. i have viewed a lot of googled csv tutorials, but none of them address everything i need. Nonetheless, I was wondering if someone can help me manipulat

Re: python sql query in django

2009-02-23 Thread Diez B. Roggisch
I may not stay with Django. I am seriously looking for whether python can read data from a relational database and send to an html template or do I always need some kind of wrapper/interface such as Rails or Django? If this is the wrong group to ask that question could you recommend another pyth

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread tav
Please use this attached updated safelite.py Victor Stinner got the dinner by using the reload builtin =) Good luck! -- love, tav plex:espians/tav | t...@espians.com | +44 (0) 7809 569 369 http://tav.espians.com | http://twitter.com/tav | skype:tavespian """ Please try and break this. On a fr

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 20:50 +, tav wrote: > I'm keen to know your experiences even if you don't manage to write to > the filesystem -- and especially if you do! > er sorry, but: from safelite import FileReader reload(__builtins__) f = open("/home/tim/nano.save","w") f.write("oops") f.close()

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Paul McNett
tav wrote: I'm keen to know your experiences even if you don't manage to write to the filesystem -- and especially if you do! Does it count when it breaks some standard libs that aren't even trying to write to the filesystem? mac:ss pmcnett$ python sbs_studio.py pkm Traceback (most recent ca

Re: python sql query in django

2009-02-23 Thread Philip Semanchuk
On Feb 23, 2009, at 4:34 PM, Diez B. Roggisch wrote: I may not stay with Django. I am seriously looking for whether python can read data from a relational database and send to an html template or do I always need some kind of wrapper/interface such as Rails or Django? If this is the wrong g

Reading a tab delimited text file.

2009-02-23 Thread Stephen
Hi, I would like to read a text file of numbers produced by a data acquisition system into three vectors of doubles. The contents of the file are: +0.000e+0 +2.7645134e+1 +2.7745625e+1 +0.4100041e-1 +2.7637787e+1 +2.7731047e+1 +0.0820008e+0 +2.7645134e+1 +2.7750483e+1 ... or +

Re: python sql query in django

2009-02-23 Thread Bruno Desthuilliers
May a écrit : (snip) I may not stay with Django. Nope, but your question was about Django. I am seriously looking for whether python can read data from a relational database Of course - as long as there's a Python adapter for your DB. and send to an html template Of course - as long as

Re: How does one get from "ImportError: DLL load failed:..." to a culprit .dll and symbol?

2009-02-23 Thread Mark Hammond
On 23/02/2009 11:41 PM, Chris Cormie wrote: If that not-very-technical description [all I've ever needed] doesn't help, you'll need to read the DW help file (HTFF1K) or wait till someone who knows what they are doing comes along :-) LOL, I am that person :p LOL sounds right! How do you ge

Re: A tale of two execs

2009-02-23 Thread aha
Hello All, So below is my naive attempt at the wrapper, it is only half baked since I am no master at Interprocess communication... I know that it is lacking a lot of things comment greatly appreciated: #!/usr/bin/env python import os, sys, re, exceptions try: import subprocess except Impor

Re: Reading a tab delimited text file.

2009-02-23 Thread Tim Chase
I would like to read a text file of numbers produced by a data acquisition system into three vectors of doubles. The contents of the file are: +0.000e+0 +2.7645134e+1 +2.7745625e+1 +0.4100041e-1 +2.7637787e+1 +2.7731047e+1 +0.0820008e+0 +2.7645134e+1 +2.7750483e+1 ... or +0.

more on unescaping escapes

2009-02-23 Thread bvdp
So, we think something is working and send of a bug fix to our client :) I'm not sure I understand this at all and wonder if there is bug? >>> a="c:\\Program\x20Files\\test" >>> a 'c:\\Program Files\\test' so far, so good. >>> a.decode("string-escape") 'c:\\Program Files\test' Umm, not so go

Re: Python AppStore / Marketplace

2009-02-23 Thread Steve Holden
Michael Torrie wrote: > Steve Holden wrote: >> Unfortunately I have no idea what a "souq" is, so I suspect this may be >> linguistically biased against English speakers. Or perhaps I'm just >> ignorant. > > Nah. Not biased against English speakers. Just biased against the > un-traveled. :) Don

Re: Python, HTTPS (SSL), tlslite and metoda POST (and lots of pain)

2009-02-23 Thread Steve Holden
yat...@gmail.com wrote: > On Feb 23, 9:57 pm, Steve Holden wrote: >> Wolfgang Rohdewald wrote: >>> On Montag, 23. Februar 2009, Steve Holden wrote: yat...@gmail.com wrote: > Hi there. [...] Yatsek: You just "hijacked a thread" by writing your question as a reply to som

RE: Peculiar swap behavior

2009-02-23 Thread andrew cooke
Delaney, Timothy (Tim) wrote: > Tim Chase wrote: >> # swap list contents...not so much... >> >>> m,n = [1,2,3],[4,5,6] >> >>> m[:],n[:] = n,m >> >>> m,n >> ([4, 5, 6], [4, 5, 6]) [...] > For these types of things, it's best to expand the code out. The > appropriate expansion of: > m,n = [1,2

Re: Reading a tab delimited text file.

2009-02-23 Thread Stephen
On Feb 23, 4:06 pm, Tim Chase wrote: > > I would like to read a text file of numbers produced by a data > > acquisition system into three vectors of doubles. The contents of the > > file are: > > > +0.000e+0      +2.7645134e+1   +2.7745625e+1 > > +0.4100041e-1      +2.7637787e+1   +2.7731047e+

Re: Top posting

2009-02-23 Thread Steve Holden
Stef Mientki wrote: > >>> btw, it's also polite (in some cultures) to sign your messages ;-) >>> >> >> Hmm. I appreciate that you took the time to remove my signature from >> your reply but I don't think that you should then claim that I never >> included one. >> >> > Sorry for that. > >

Re: A tale of two execs

2009-02-23 Thread aha
I've decided to change the runCmdLine method to Popen. On Feb 23, 4:54 pm, aha wrote: > Hello All, >   So below is my naive attempt at the wrapper, it is only half baked > since I am no master at Interprocess communication... I know that it > is lacking a lot of things comment greatly appreciated:

Re: Reading a tab delimited text file.

2009-02-23 Thread Mel
Stephen wrote: > Hi, > > I would like to read a text file of numbers produced by a data > acquisition system into three vectors of doubles. The contents of the > file are: > > +0.000e+0 +2.7645134e+1 +2.7745625e+1 > > +0.4100041e-1 +2.7637787e+1 +2.7731047e+1 > > +0.0820008e+0 +2.76451

Re: more on unescaping escapes

2009-02-23 Thread MRAB
bvdp wrote: So, we think something is working and send of a bug fix to our client :) I'm not sure I understand this at all and wonder if there is bug? >>> a="c:\\Program\x20Files\\test" >>> a 'c:\\Program Files\\test' so far, so good. >>> a.decode("string-escape") 'c:\\Program Files\test'

Re: Reading a tab delimited text file.

2009-02-23 Thread Tim Chase
time_vec, ch1_vec, and_so_on = zip(*( map(float, line.split()) for line in file('in.txt'))) If this isn't homework, there are some less terse versions which are a bit easier on the eyes and less like some love-child between Perl and Python. haha, no this isn't homework. I'm a mecha

Re: Peculiar swap behavior

2009-02-23 Thread Robert Kern
On 2009-02-23 16:17, andrew cooke wrote: Delaney, Timothy (Tim) wrote: Tim Chase wrote: # swap list contents...not so much... >>> m,n = [1,2,3],[4,5,6] >>> m[:],n[:] = n,m >>> m,n ([4, 5, 6], [4, 5, 6]) [...] For these types of things, it's best to expand the code out. The appropriat

Re: Python won't run

2009-02-23 Thread Ned Deily
[Again, please reply-all to the list, don't send private email!] On Feb 23, 2009, at 14:03 , kevin hayes wrote: > Ned, system log didn't do anything when I tried to open IDLE. However, this > is what's in the console.log. does this tell you anything? > > Unhandled server exception! > Thread: Soc

Re: A tale of two execs

2009-02-23 Thread Steve Holden
aha wrote: > I've decided to change the runCmdLine method to Popen. > [...] So just exactly why was it necessary to follow this remark with about three hundred lines of quoted text? And can't you put your replies at the bottom rather than the top, please? And trim the stuff that isn't required. It

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 13:20 -0800, Paul McNett wrote: > tav wrote: > > I'm keen to know your experiences even if you don't manage to write to > > the filesystem -- and especially if you do! > > Does it count when it breaks some standard libs that aren't even trying to > write to > the filesystem

read csv error question

2009-02-23 Thread Vincent Davis
I am trying to read a csv file from excel on a mac. I get the following error.SystemExit: file some.csv, line 1: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? I was using the example code import csv, sys reader = csv.reader(open('/Volumes/vince

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Luis Zarrabeitia
On Monday 23 February 2009 03:50:57 pm tav wrote: > Hey all, > > As an attempt to convince Python-Dev of the merits of a > functions-based approach to security in Python, I've come up with a > simple challenge. > While I'm almost excited that you are tackling the problem of python's security, I f

Re: Peculiar swap behavior

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 10:43 AM, Tim Chase wrote: > # swap list contents...not so much... m,n = [1,2,3],[4,5,6] m[:],n[:] = n,m m,n > ([4, 5, 6], [4, 5, 6]) Pseudo-C-Python expansion: #evaluate RHS. simply *take pointers* since the RHS is just plain variables ptr_n = &n ptr_m = &

thanks very much indeed for your help is there a better way to do this (python3) newby

2009-02-23 Thread Gary Wood
'''exercise to complete and test this function''' import string def joinStrings(items): '''Join all the strings in stringList into one string, and return the result. For example: >>> print joinStrings(['very', 'hot', 'day']) 'veryhotday' ''' for i in items: return (''

Re: "import" not working?

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 18:10:07 -0200, Lionel escribió: Taking "DataFileTypes.py" module out of the "...\site-packages \DataFileTypes" folder and placing it directly into the "site- packages" folder seems to have cleared it up. Some problem between package and module usage I suppose. You're ri

Re: Reading a tab delimited text file.

2009-02-23 Thread harijay
You could also use the csv module import csv myfileobj = open("myfiletab.txt","read") csv_read = csv.reader(myfileobj,dialect=csv.excel_tab) myval1 = [] myval2 = [] myval3 = [] for line in csv_read: # filter header and stuff using some criterion if len(line) = 3: myval1.append(line[0])

RE: Peculiar swap behavior

2009-02-23 Thread andrew cooke
andrew cooke wrote: > Delaney, Timothy (Tim) wrote: >> Tim Chase wrote: >>> # swap list contents...not so much... >>> >>> m,n = [1,2,3],[4,5,6] >>> >>> m[:],n[:] = n,m >>> >>> m,n >>> ([4, 5, 6], [4, 5, 6]) > [...] >> For these types of things, it's best to expand the code out. The >> appropriat

read csv error question

2009-02-23 Thread rdmurray
Vincent Davis wrote: > I am trying to read a csv file from excel on a mac. I get the following > error.SystemExit: file some.csv, line 1: new-line character seen in unquoted > field - do you need to open the file in universal-newline mode? > I was using the example code > import csv, sys > > read

Re: read csv error question

2009-02-23 Thread MRAB
Vincent Davis wrote: I am trying to read a csv file from excel on a mac. I get the following error. SystemExit: file some.csv, line 1: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? I was using the example code import csv, sys reader = csv.r

Re: Reference or Value?

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 17:17:04 -0200, Brian Blais escribió: On Feb 23, 2009, at 3:03 , Gabriel Genellina wrote: En Mon, 23 Feb 2009 03:54:16 -0200, Denis Kasak escribió: On Mon, Feb 23, 2009 at 5:09 AM, Steven D'Aprano wrote: On Sun, 22 Feb 2009 13:37:27 -0300, andrew cooke wrote: as far a

Re: read csv error question

2009-02-23 Thread Benjamin Kaplan
On Mon, Feb 23, 2009 at 6:43 PM, MRAB wrote: > Vincent Davis wrote: > >> I am trying to read a csv file from excel on a mac. I get the following >> error. >> SystemExit: file some.csv, line 1: new-line character seen in unquoted >> field - do you need to open the file in universal-newline mode? >

Re: read csv error question

2009-02-23 Thread Vincent Davis
Thanks for the help the "U" was what I needed. I was reading the documentation here.http://docs.python.org/library/csv.html but I could not find the term universal-newline mode, In fact where do you find "U" I have not read it word for word but it is not obvious to me. I do even see anything about

Re: more on unescaping escapes

2009-02-23 Thread bvdp
I'm getting hopelessly lost in a series of \\\ s :) Let's see if this makes sense: >>> a='c:\\Program Files\\test' >>> a.decode('string-escape') 'c:\\Program Files\test' In this case there are still 2 '\'s before the P; but only 1 before the 't'. Now, when it comes time to open the file w

Re: read csv error question

2009-02-23 Thread Vincent Davis
I just thought to look in the documentation for open() It seems this may contain the answers to my questions. I am just to new to python to know where my problem is, Thanks Vincent Davis 720-301-3003 On Mon, Feb 23, 2009 at 4:52 PM, Benjamin Kaplan wrote: > > > On Mon, Feb 23, 2009 at 6:43 PM, M

Re: read csv error question

2009-02-23 Thread MRAB
Benjamin Kaplan wrote: On Mon, Feb 23, 2009 at 6:43 PM, MRAB > wrote: Vincent Davis wrote: I am trying to read a csv file from excel on a mac. I get the following error. SystemExit: file some.csv, line 1: new-line character seen

Re: more on unescaping escapes

2009-02-23 Thread andrew cooke
do you know that a string with the letter "r" in front doesn't escape slashes? it's intended for regular expressions, but would simplify things for you here too. just do a=r'c:\\Program Files\test' andrew bvdp wrote: > > I'm getting hopelessly lost in a series of \\\ s :) > > Let's see

Re: can error messages be improved or can they be overridden ?

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 15:54:03 -0200, escribió: Stef Mientki wrote: but I was looking for a more general solution, in which I don't change the program itself, and where the error messages (in general) become more informative than it is by default. No you are not the only one who wishes the er

Re: more on unescaping escapes

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 17:00 -0700, bvdp wrote: > Let's see if this makes sense: > > >>> a='c:\\Program Files\\test' > >>> a.decode('string-escape') > 'c:\\Program Files\test' Hint: try running >>> print a and see what's written - I think that the interpreter adds extra "\" characters to escap

Re: "import" not working?

2009-02-23 Thread Rhodri James
On Mon, 23 Feb 2009 19:24:46 -, Lionel wrote: sys.path.append("C:\DataFileTypes") Just so that we're clear, this is a *really* *bad* habit to get into. Not appending to sys.path, though that isn't often a good idea, but failing to escape your backslashes. This works because '\D' happens

Re: Need to store dictionary in file

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 12:38 PM, S.Selvam Siva wrote: > Hi all, > > I have a dictionary in which each key is associated with a list as value. > > eg: dic={'a':['aa','ant','all']} > > The dictionary contains 1.5 lakh keys. Tip: You might not want to use the "lakh" in international media such as i

Re: more on unescaping escapes

2009-02-23 Thread bvdp
andrew cooke wrote: do you know that a string with the letter "r" in front doesn't escape slashes? it's intended for regular expressions, but would simplify things for you here too. just do a=r'c:\\Program Files\test' Yes, I knew that. Unfortunately in my program loop I really don't have

getting at individual bits inside byte field: struct module : bitwise operator

2009-02-23 Thread harijay
In my last post I had asked about reading data from a binary file using the struct module. Thanks to some excellent help , I have managed to read in successfully most of the header of this binary format that I want to parse. These are some time-voltage traces from a digital to analog converter for

Re: Can someone tell me why i get None at the end please this has me stuck for ages

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 11:22 AM, Gary Wood wrote: > '''exercise to complete and test this function''' > import string > def joinStrings(items): > '''Join all the strings in stringList into one string, > and return the result. For example: > >>> print joinStrings(['very', 'hot', 'day']

Re: more on unescaping escapes

2009-02-23 Thread bvdp
Tim Wintle wrote: On Mon, 2009-02-23 at 17:00 -0700, bvdp wrote: Let's see if this makes sense: >>> a='c:\\Program Files\\test' >>> a.decode('string-escape') 'c:\\Program Files\test' Hint: try running print a and see what's written - I think that the interpreter adds extra "\" character

Re: more on unescaping escapes

2009-02-23 Thread Rhodri James
On Mon, 23 Feb 2009 22:05:42 -, bvdp wrote: So, we think something is working and send of a bug fix to our client :) I'm not sure I understand this at all and wonder if there is bug? >>> a="c:\\Program\x20Files\\test" >>> a 'c:\\Program Files\\test' so far, so good. >>> a.decode("st

Re: intermediate python csv reader/writer question from a beginner

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 1:33 PM, Learning Python wrote: > anything related to csv, I usually use VB within excel to manipulate > the data, nonetheless, i finally got the courage to take a dive into > python. i have viewed a lot of googled csv tutorials, but none of > them address everything i nee

Re: Can someone tell me why i get None at the end please this has me stuck for ages

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 17:22:16 -0200, Gary Wood escribió: '''exercise to complete and test this function''' import string def joinStrings(items): '''Join all the strings in stringList into one string, and return the result. For example: >>> print joinStrings(['very', 'hot', 'day'])

Re: can error messages be improved or can they be overridden ?

2009-02-23 Thread python
Gabriel, > Have you seen the cgitb module? Despite its name, it's a general purpose > module. > > > import cgitb > cgitb.enable(format="txt") > > My vote for tip of the week, perhaps even month. I'm not part of this thread, but your post is a great

Re: more on unescaping escapes

2009-02-23 Thread Rhodri James
On Tue, 24 Feb 2009 00:26:29 -, bvdp wrote: So, in this case I'm assuming that the interpreter is converting the escapes on assignment. The compiler converts the escapes on creating its internal representation of the string, before assignment ever gets involved. -- Rhodri James *-* Wild

Re: getting at individual bits inside byte field: struct module : bitwise operator

2009-02-23 Thread MRAB
harijay wrote: In my last post I had asked about reading data from a binary file using the struct module. Thanks to some excellent help , I have managed to read in successfully most of the header of this binary format that I want to parse. These are some time-voltage traces from a digital to ana

Re: more on unescaping escapes

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there any particular reason you can't just internally use regular forward-slashes for the paths? They work in Windows from Python in nearly all cases and you can easily interconvert using os.

Re: more on unescaping escapes

2009-02-23 Thread bvdp
Chris Rebert wrote: On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there any particular reason you can't just internally use regular forward-slashes for the paths? They work in Windows from Python in nearly all cases and you can easily

Re: more on unescaping escapes

2009-02-23 Thread bvdp
Bear in mind that it's the string as it really is that is being operated on, not the representation of it that you displayed Yes, that is the confusion ... what is displayed and what's actually in the string. I think I understand it all now :) Thanks. -- http://mail.python.org/mailman/lis

Re: Python AppStore / Marketplace

2009-02-23 Thread Rhodri James
On Mon, 23 Feb 2009 22:12:09 -, Steve Holden wrote: Michael Torrie wrote: Steve Holden wrote: Unfortunately I have no idea what a "souq" is, so I suspect this may be linguistically biased against English speakers. Or perhaps I'm just ignorant. Nah. Not biased against English speakers

Re: getting at individual bits inside byte field: struct module : bitwise operator

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 22:18:31 -0200, harijay escribió: mentioned here : ( http://www.dataq.com/support/techinfo/ff.htm) I have a question about how to bitmask a bunch of bytes read in from such a binary formatted file . For eg the spec says the first two bytes have different parameters in diff

Re: more on unescaping escapes

2009-02-23 Thread Mel
bvdp wrote: > Not sure if it's more clear or not :) > > >>> a="c:\\Program\x20Files\\test" > >>> a > 'c:\\Program Files\\test' > >>> print a > c:\Program Files\test > > Which is all fine. And I didn't need to use decode(). > > So, in this case I'm assuming that the interpreter is converting t

Re: Peculiar swap behavior

2009-02-23 Thread John Posner
>> m,n = [1,2,3],[4,5,6] >> m[:],n[:] = n,m I believe this is an RTFM situation. In the Python 2.6.1 help topic "Simple Statements" > "Assignment Statements", see this para: If the target is a slicing: The primary expression in the reference is evaluated. It should yield a mutable seq

Re: more on unescaping escapes

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 22:46:34 -0200, bvdp escribió: Chris Rebert wrote: On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there any particular reason you can't just internally use regular forward-slashes for the paths? They work in Windo

Re: thanks very much indeed for your help is there a better way to do this (python3) newby

2009-02-23 Thread Rhodri James
On Mon, 23 Feb 2009 23:33:31 -, Gary Wood wrote: '''exercise to complete and test this function''' import string def joinStrings(items): '''Join all the strings in stringList into one string, and return the result. For example: >>> print joinStrings(['very', 'hot', 'day']) '

Re: more on unescaping escapes

2009-02-23 Thread bvdp
Gabriel Genellina wrote: En Mon, 23 Feb 2009 22:46:34 -0200, bvdp escribió: Chris Rebert wrote: On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there any particular reason you can't just internally use regular forward-slashes for the

Re: can error messages be improved or can they be overridden ?

2009-02-23 Thread rdmurray
"andrew cooke" wrote: > rdmur...@bitdance.com wrote: > [...] > > (You know, I really ought to revisit that routine and make it part > > of my standard development toolbox.) > > please post it OK. I dug it up, cut out the stuff that was specific to the application, freshened it up a little,

Code in __init__.py, is it bad form?

2009-02-23 Thread Michael Crute
Is it bad form (i.e. non-pythonic) to have code in your __init__.py files? I know this is subjective so I'm just looking for the general consensus. I've heard both sides of the story and I personally feel its okay if the code pertains to the whole module but have an open mind about the matter. If y

Re: Need to store dictionary in file

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 18:38:56 -0200, S.Selvam Siva escribió: I have a dictionary in which each key is associated with a list as value. eg: *dic={'a':['aa','ant','all']}* The dictionary contains *1.5 lakh keys*. Now i want to store it to a file,and need to be loaded to python program during e

Re: more on unescaping escapes

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 23:31:20 -0200, bvdp escribió: Gabriel Genellina wrote: En Mon, 23 Feb 2009 22:46:34 -0200, bvdp escribió: Chris Rebert wrote: On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there any particular reason you ca

Re: Peculiar swap behavior

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 22:58:44 -0200, John Posner escribió: m,n = [1,2,3],[4,5,6] m[:],n[:] = n,m I believe this is an RTFM situation. In the Python 2.6.1 help topic "Simple Statements" > "Assignment Statements", see this para: Yes, the other relevant paragraph is: """An assign

Re: Code in __init__.py, is it bad form?

2009-02-23 Thread Steve Holden
Michael Crute wrote: > Is it bad form (i.e. non-pythonic) to have code in your __init__.py > files? I know this is subjective so I'm just looking for the general > consensus. I've heard both sides of the story and I personally feel > its okay if the code pertains to the whole module but have an ope

Re: more on unescaping escapes

2009-02-23 Thread bvdp
Gabriel Genellina wrote: En Mon, 23 Feb 2009 23:31:20 -0200, bvdp escribió: Gabriel Genellina wrote: En Mon, 23 Feb 2009 22:46:34 -0200, bvdp escribió: Chris Rebert wrote: On Mon, Feb 23, 2009 at 4:26 PM, bvdp wrote: [problem with Python and Windows paths using backslashes] Is there an

Re: Code in __init__.py, is it bad form?

2009-02-23 Thread Michael Crute
On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden wrote: > Michael Crute wrote: >> Is it bad form (i.e. non-pythonic) to have code in your __init__.py >> files? I know this is subjective so I'm just looking for the general >> consensus. I've heard both sides of the story and I personally feel >> its o

Re: ZSI / MTOM

2009-02-23 Thread Cameron Simpson
On 23Feb2009 08:09, John Ionides wrote: | I have project for which I would like to have a python web service | including MTOM. It seems that ZSI is the most complete python web | service library but that it doesn't currently support MTOM - and | having worked through the code it looks as though it

Re: Code in __init__.py, is it bad form?

2009-02-23 Thread Benjamin Peterson
Michael Crute gmail.com> writes: > On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden holdenweb.com> > wrote: > > No, it's absolutely fine. One common usage is to import symbols from > > sub-modules so that they are available from a simple import of the package. > > Yeah, I use it often for that I'm

Re: Code in __init__.py, is it bad form?

2009-02-23 Thread Ben Finney
Michael Crute writes: > Is it bad form (i.e. non-pythonic) to have code in your __init__.py > files? No, it's good form, but *only* for code that truly pertains to the entire package. Anything that can reasonably be in a module other than ‘__init__’, should be. That leaves the following things

Re: Code in __init__.py, is it bad form?

2009-02-23 Thread alex23
On Feb 24, 12:21 pm, Michael Crute wrote: > Yeah, I use it often for that I'm talking more about stuff like > utility functions, main methods, etc... Personally, I use it only for those tasks related to 'initialising' the package, a la the importing of various modules for convenience sake (as men

<    1   2   3   >