Re: Reference or Value?

2009-02-23 Thread Gabriel Genellina
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 as i understand things, the best model is: 1 - everything is an object 2 - everything is passed by reference

Re: different errors, return outside function and others

2009-02-23 Thread Tony
The full error message says "There's an error in your program: *** 'return' outside function (final(2).py, line 114) which is were this return statement is.. while introselection < 1 or introselection > 2: print 'That area is unavaible please buy the expansion haha' return introse

RE: Is there a way to ask a class what its metaclasses are ?

2009-02-23 Thread Barak, Ron
> -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Sunday, February 22, 2009 22:12 > To: Barak, Ron > Cc: python-list@python.org > Subject: Re: Is there a way to ask a class what its metaclasses are ? > > On Sun, Feb 22, 2009 at

confusing UnboundLocalError behaive

2009-02-23 Thread neoedmund
see the 3 small piece of code, i cannot understand why it result as this. 1. def test(): abc="111" def m1(): print(abc) m1() test() Output: 111 2. def test(): abc="111" def m1(): print(abc) abc+="222"

pysqlite smart search

2009-02-23 Thread klia
Hey guys; I am trying to develop a tiny program using python to search inside sqlite database with file extension is .db in which the program will ask users to enter their search query and base on that it will retrieve the results But I need the program to have some smartness in search mechanis

Re: different errors, return outside function and others

2009-02-23 Thread Chris Rebert
Ok, that's not a standard Python error report (I'm guessing you're using an IDE of some sort). Also, something's not right because your excerpt doesn't match the source you posted. In your previous post, the 'while' line in question was given as: while introselection < 1 or introselection > 2 Not

Re: different errors, return outside function and others

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 04:51:39 -0200, Tony escribió: Hi, I am trying to write a small program for my final for school, everytime i run my program it gives me a return outside function error (after i fixed all the indentation errors it throws at me), i am not very good at programing with python

Re: confusing UnboundLocalError behaive

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 12:06 AM, neoedmund wrote: > see the 3 small piece of code, i cannot understand why it result as > this. > > 1. > def test(): >abc="111" >def m1(): >print(abc) >m1() > test() > > Output: 111 > > 2. > def test(): >abc="111" >

Re: confusing UnboundLocalError behaive

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 06:06:58 -0200, neoedmund escribió: it seems "you cannot change the outter scope values but can use it readonly." Exactly. Python doesn't have variable "declarations" - so the compiler uses this rule: "if the variable is assigned to, anywhere in the function body, it's

Re: confusing UnboundLocalError behaive

2009-02-23 Thread Steven D'Aprano
On Mon, 23 Feb 2009 00:06:58 -0800, neoedmund wrote: > see the 3 small piece of code, i cannot understand why it result as > this. > > 1. > def test(): > abc="111" > def m1(): > print(abc) > m1() > test() > > Output: 111 abc is local to test(). print(abc) looks f

Re: pysqlite smart search

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 06:17:41 -0200, klia escribió: I need the program to have some smartness in search mechanism in which the program will guess that the user is looking for these key words in the database. so far i came up with this but the search ain't smart, i have to write the full

Re: different errors, return outside function and others

2009-02-23 Thread Tony
ok thank you for that input, this is my first class in programming and its the only one the school offers. im pretty sure those are supposed to be modules that im writting. would it make a difference if those were modules and not functions? kinda stupid question there but im trying to learn as much

Re: Is there a way to ask a class what its metaclasses are ?

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 06:09:44 -0200, Barak, Ron escribió: > I'm asking, because, even subclassing from object, viz.: > > class CopyAndPaste(object): > def __init__(self): > pass > ... > > Still gives me: > > $ python -u ./failover_pickle_demo09.py Traceback (most recent call > last

Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Barak, Ron
Hi Guys, Thanks to Michele, Chris, Hrvoje et. al. who helped me trying to resolve the metaclass exception when a class has two parents problem. This post tries to unify all the metaclasses exception threads, in an attempt to reach a solution. I've created a short demo script (metaclass_test01.p

Re: can multi-core improve single funciton?

2009-02-23 Thread Nick Craig-Wood
sturlamolden wrote: > On Feb 10, 8:38?am, Paul McGuire wrote: > > > Even worse than linear, the function is recursive, which as I > > understand it, is inherently a no-no when looking for code that is > > parallel-friendly. > > There is no way to parallelize Fibonacci numbers computed with li

Re: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Tim Golden
$ cat -n metaclass_test01.py | head 1 #!/usr/bin/env python 2 3 import sys 4 import wx 5 import CopyAndPaste 6 7 class ListControl(wx.Frame, CopyAndPaste): 8 #class ListControl(wx.Frame): 9 def __init__(self, parent, id, title, list, max_list

Re: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 07:32:52 -0200, Barak, Ron escribió: $ cat -n metaclass_test01.py | head 1 #!/usr/bin/env python 2 3 import sys 4 import wx 5 import CopyAndPaste 6 7 class ListControl(wx.Frame, CopyAndPaste): 8 #class ListControl(wx.Frame):

Access from class variable to one on constructor

2009-02-23 Thread Kless
How to access from a class variable to one that is initialized on the constructor? -- class Foo(): foo = bar # I want to access *from here* to variables created on the constructor. def __init__(self, bar_init): self.bar = bar_init -- Note: I've to create a subclas

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

2009-02-23 Thread Stef Mientki
thanks Ron, 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. cheers, Stef Barak, Ron wrote: Hi Stef, You can do something like (not tested): try: self.Brick

Re: different errors, return outside function and others

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 07:07:57 -0200, Tony escribió: ok thank you for that input, this is my first class in programming and its the only one the school offers. im pretty sure those are supposed to be modules that im writting. would it make a difference if those were modules and not functio

Re: Access from class variable to one on constructor

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 07:40:47 -0200, Kless escribió: How to access from a class variable to one that is initialized on the constructor? -- class Foo(): foo = bar # I want to access *from here* to variables created on the constructor. def __init__(self, bar_init): self.bar

shared lib from python code?

2009-02-23 Thread Gabriel Rossetti
Hello everyone, I would like to know if it is possible to turn python code into a shared lib? I have several processes that use the same base code, and it seems like every process loads the "shared" code into memory. I would like it to be loaded once and shared, like a .so in linux or a .dll i

Re: shared lib from python code?

2009-02-23 Thread Paul Rubin
Gabriel Rossetti writes: > I would like to know if it is possible to turn python code into a > shared lib? I have several processes that use the same base code, and > it seems like every process loads the "shared" code into memory. I > would like it to be loaded once and shared, like a .so in linu

Re: Get variables on constructor [Solved]

2009-02-23 Thread Kless
On 23 feb, 10:17, Kless wrote: > To get class variables can be used *for i in dir(self): * but how to > get variables initialized on the constructor? Sorry. It's so simple as insert *self*. -- http://mail.python.org/mailman/listinfo/python-list

Re: shared lib from python code?

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 08:10:16 -0200, Gabriel Rossetti escribió: I would like to know if it is possible to turn python code into a shared lib? I have several processes that use the same base code, and it seems like every process loads the "shared" code into memory. I would like it to be lo

Re: Access from class variable to one on constructor [Solved]

2009-02-23 Thread Kless
Thanks Gabriel. You have reason, and I was having a design error. On 23 feb, 10:02, "Gabriel Genellina" wrote: > En Mon, 23 Feb 2009 07:40:47 -0200, Kless   > escribió: > > > How to access from a class variable to one that is initialized on the > > constructor? > > -- > > class Foo()

Re: Reference or Value?

2009-02-23 Thread andrew cooke
Steven D'Aprano wrote: > On Sun, 22 Feb 2009 13:37:27 -0300, andrew cooke wrote: > >> as far as i understand things, the best model is: >> >> 1 - everything is an object >> 2 - everything is passed by reference > > Except that is wrong. If it were true, you could do this: [pointer swapping] i was

Re: shared lib from python code?

2009-02-23 Thread Gabriel Rossetti
Gabriel Rossetti wrote: Hello everyone, I would like to know if it is possible to turn python code into a shared lib? I have several processes that use the same base code, and it seems like every process loads the "shared" code into memory. I would like it to be loaded once and shared, like a

ANN: Shed Skin 0.1, an experimental (restricted-)Python-to-C++ Compiler

2009-02-23 Thread Mark Dufour
Hi all, I have recently released version 0.1 of Shed Skin, an experimental (restricted-)Python-to-C++ compiler. Please see my blog for more info about the release: http://shed-skin.blogspot.com Thanks, Mark Dufour. -- "One of my most productive days was throwing away 1000 lines of code" - Ken

Re: ANN: Shed Skin 0.1, an experimental (restricted-)Python-to-C++ Compiler

2009-02-23 Thread James Matthews
Nice! I was looking for one of these for a while On Mon, Feb 23, 2009 at 1:54 PM, Mark Dufour wrote: > Hi all, > > I have recently released version 0.1 of Shed Skin, an experimental > (restricted-)Python-to-C++ compiler. > > Please see my blog for more info about the release: > > http://shed-ski

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

2009-02-23 Thread Chris Cormie
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 Your technique works well and it does provide the information and it is a (roun

Server programming

2009-02-23 Thread koranthala
Hi, Is server programming in Python procedure oriented or object oriented? 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 programs earlier (in Python itself), the whole thing b

Re: pysqlite smart search

2009-02-23 Thread klia
klia wrote: > > Hey guys; > > I am trying to develop a tiny program using python to search inside sqlite > database with file extension is .db in which the program will ask users to > enter their search query and base on that it will retrieve the results But > > I need the program to have so

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

2009-02-23 Thread John Machin
On Feb 23, 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 It wasn't apparent, and st

Re: shared lib from python code?

2009-02-23 Thread Duncan Booth
Gabriel Rossetti wrote: > Ok, maybe I mis-stated my problem (or mis-understood your answers).. I > don' t want to share code as in have multiple processes access a > variable and have the same value, like it is done in threads, what I > want is to not have n copies of the code (classes, functi

Re: shared lib from python code?

2009-02-23 Thread Diez B. Roggisch
Gabriel Rossetti schrieb: Gabriel Rossetti wrote: Hello everyone, I would like to know if it is possible to turn python code into a shared lib? I have several processes that use the same base code, and it seems like every process loads the "shared" code into memory. I would like it to be loa

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

2009-02-23 Thread Gabriel Genellina
En Mon, 23 Feb 2009 10:41:20 -0200, Chris Cormie escribió: 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 Your technique wor

opening files with names in non-english characters.

2009-02-23 Thread venutaurus...@gmail.com
Hi all, I am trying to find the attributes of afile whose name has non english characters one like given below. When I try to run my python scirpt, it fails giving out an error filename must be in string or UNICODE. When i try to copy the name of the file as a strinig, it (KOMODO IDE) is

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

2009-02-23 Thread Chris
On Feb 23, 11:57 am, Stef Mientki wrote: > thanks Ron, > > 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. > > cheers, > Stef > > Barak, Ron wrote: > > Hi Stef,

Re: shared lib from python code?

2009-02-23 Thread andrew cooke
Gabriel Rossetti wrote: > Ok, maybe I mis-stated my problem (or mis-understood your answers).. I > don' t want to share code as in have multiple processes access a > variable and have the same value, like it is done in threads, what I > want is to not have n copies of the code (classes, functions,

Getting Certification Chain from Digital Signature

2009-02-23 Thread Good Z
All, I need to extract certification chain/private key from digital signature certificate (DSC). The Digital Signature (DSC) is in PFX file format. I got the Java code but do not know the python equivalent in python. Any help will be appreciated. Best Regards, Mike -- http://mail.pyth

Re: count secton of data in list

2009-02-23 Thread S Arrowsmith
In article <3ed253bb-d6ec-4f47-af08-ad193e9c4...@h16g2000yqj.googlegroups.com>, odeits wrote: >def count_consecutive(rows): >switch =3D 0 >count =3D 0 >for r in rows: >if r[-1] =3D=3D switch: >count +=3D 1 >else: >switch =3D not switch >

Re: pysqlite smart search

2009-02-23 Thread Bret Fledderjohn
2009/2/23 klia > > > > klia wrote: > > > > Hey guys; > > > > I am trying to develop a tiny program using python to search inside > sqlite > > database with file extension is .db in which the program will ask users > to > > enter their search query and base on that it will retrieve the results >

Solved: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Barak, Ron
Hi, > -Original Message- > From: Tim Golden [mailto:m...@timgolden.me.uk] > Sent: Monday, February 23, 2009 11:37 > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: Metaclass conflict TypeError exception: problem > demonstration script > > > $ cat -n metaclass_

Re: Solved: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Tim Golden
Barak, Ron wrote: That's it. Once I changed my class header to: $ cat -n metaclass_test01.py 1 #!/usr/bin/env python 2 3 import sys 4 import wx 5 import CopyAndPaste 6 7 class ListControl(wx.Frame, CopyAndPaste.CopyAndPaste): I'm getting no more Metaclas

Re: pysqlite smart search

2009-02-23 Thread Diez B. Roggisch
klia schrieb: klia wrote: Hey guys; I am trying to develop a tiny program using python to search inside sqlite database with file extension is .db in which the program will ask users to enter their search query and base on that it will retrieve the results But I need the program to have som

Re: programming by evolution?

2009-02-23 Thread Xah Lee
On Feb 23, 4:56 am, Roedy Green wrote: > On 19 Feb 2009 18:56:42 GMT, Albert van der Horst > wrote, quoted or indirectly quoted someone > who said : > > >Note here, that eXtreme > >>Programing is one of the snake oil, > > Extreme programming is a variant on Deming's idea of constant > incremental

ZSI / MTOM

2009-02-23 Thread John Ionides
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 isn't going to be exactly simple. Is there anyon

charset problems with urllib/urllib2

2009-02-23 Thread Brot
Hello, I am using the mailman-installation (http://www.gnu.org/software/ mailman/) from my hosting company. I doesn't have access to the add_members script and so I am writing a python script which uses http requests to subscribe new members. But if I am posting a new member with an name, which i

Re: programming by evolution?

2009-02-23 Thread Roedy Green
On 19 Feb 2009 18:56:42 GMT, Albert van der Horst wrote, quoted or indirectly quoted someone who said : >Note here, that eXtreme >>Programing is one of the snake oil, Extreme programming is a variant on Deming's idea of constant incremental improvement that revolutionised quality in manufacturin

Get variables on constructor

2009-02-23 Thread Kless
To get class variables can be used *for i in dir(self): * but how to get variables initialized on the constructor? -- http://mail.python.org/mailman/listinfo/python-list

Re: different errors, return outside function and others

2009-02-23 Thread Terry Reedy
Tony wrote: The full error message says "There's an error in your program: *** 'return' outside function (final(2).py, line 114) Ah, you left the quotes off before, and you still omitted the error class (SyntaxError, see below). When you are puzzled by an error, try to reduce the executed co

A tale of two execs

2009-02-23 Thread aha
Hello All, I am working on a project where I need to support versions of Python as old as 2.3. Previously, we distributed Python with our product, but this seemed a bit silly so we are no longer doing this. The problem that I am faced with is that we have Python scripts that use the subprocess m

Python Imaging Library (PIL): create PDF from scratch

2009-02-23 Thread zelegolas
Hi, I have some scan generated by SANE and i would like to do some transformation (like crop, brightness and resize) and finaly put all those images in PDF file. With PIL i can do all the transformations that i want. But i don't know how i can create from scratch a PDF. I'm not even sure that PIL

Re: A tale of two execs

2009-02-23 Thread Matt Nordhoff
aha wrote: > Hello All, > I am working on a project where I need to support versions of Python > as old as 2.3. Previously, we distributed Python with our product, but > this seemed a bit silly so we are no longer doing this. The problem > that I am faced with is that we have Python scripts that

Re: A tale of two execs

2009-02-23 Thread bieffe62
On Feb 23, 5:53 pm, aha wrote: > Hello All, >   I am working on a project where I need to support versions of Python > as old as 2.3. Previously, we distributed Python with our product, but > this seemed a bit silly so we are no longer doing this.  The problem > that I am faced with is that we hav

Python shell scripting and errors

2009-02-23 Thread Phillip B Oldham
I've got a python script running as a daemon (using someone else's daemon module). It runs fine for a while, but will occasionally balk and die. Since its running in the background, I'm getting no error from it. What's the best way to capture the output into a file for later review? -- http://mail

Re: Python shell scripting and errors

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: > I've got a python script running as a daemon (using someone else's > daemon module). It runs fine for a while, but will occasionally balk > and die. Since its running in the background, I'm getting no error > from it. > > What's the best

Re: Is there a way to ask a class what its metaclasses are ?

2009-02-23 Thread Terry Reedy
Barak, Ron wrote: When I try the following (to see the types of the classes involved): #!/usr/bin/env python import wx from Debug import _line as line class CopyAndPaste(object): def __init__(self, *args, **kwargs): super(CopyAndPaste, self).__init__(*args, **kwargs) pr

Re: A tale of two execs

2009-02-23 Thread bieffe62
On Feb 23, 6:06 pm, bieff...@gmail.com wrote: > On Feb 23, 5:53 pm, aha wrote: > > > > > > > Hello All, > >   I am working on a project where I need to support versions of Python > > as old as 2.3. Previously, we distributed Python with our product, but > > this seemed a bit silly so we are no lon

Re: Python shell scripting and errors

2009-02-23 Thread Philip Semanchuk
On Feb 23, 2009, at 12:21 PM, Tim Wintle wrote: On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: I've got a python script running as a daemon (using someone else's daemon module). It runs fine for a while, but will occasionally balk and die. Since its running in the background, I'm g

Re: Reference or Value?

2009-02-23 Thread Steve Holden
Denis Kasak wrote: > 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 as i understand things, the best model is: >>> >>> 1 - everything is an object >>> 2 - everything is passed by reference >> Except that is wrong.

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

2009-02-23 Thread rdmurray
Stef Mientki wrote: > thanks Ron, > > 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. [snip] > >> -Original Message- > >> From: Stef Mientki [mailto:s

Re: Server programming

2009-02-23 Thread Steve Holden
koranthala wrote: > Hi, > Is server programming in Python procedure oriented or object > oriented? > 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 programs earlier (in Pyt

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

2009-02-23 Thread andrew cooke
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 andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: opening files with names in non-english characters.

2009-02-23 Thread Chris Rebert
On Mon, Feb 23, 2009 at 5:51 AM, venutaurus...@gmail.com wrote: > Hi all, > I am trying to find the attributes of afile whose name has > non english characters one like given below. When I try to run my > python scirpt, it fails giving out an error filename must be in string > or UNICODE.

Re: Python Imaging Library (PIL): create PDF from scratch

2009-02-23 Thread Steve Holden
zelegolas wrote: > Hi, > > I have some scan generated by SANE and i would like to do some > transformation (like crop, brightness and resize) and finaly put all > those images in PDF file. > > With PIL i can do all the transformations that i want. But i don't > know how i can create from scratch

unescape escapes in strings

2009-02-23 Thread bvdp
When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ... as compared to an assi

Re: unescape escapes in strings

2009-02-23 Thread MRAB
bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ... as compared t

Which GROUP to join ?

2009-02-23 Thread Ben
hello, I have written a parameter driven menuing and screen system for S-Lang called SLAG. It is very intuitive and easy to use and was designed to rapidly build Accounting Applications with. I am currently working on porting it to Python. Which DEV group in Python should I join to get help and

Re: Which GROUP to join ?

2009-02-23 Thread Robert Kern
On 2009-02-23 12:29, Ben wrote: hello, I have written a parameter driven menuing and screen system for S-Lang called SLAG. It is very intuitive and easy to use and was designed to rapidly build Accounting Applications with. I am currently working on porting it to Python. Which DEV group in Pyt

Re: Which GROUP to join ?

2009-02-23 Thread Mike Driscoll
On Feb 23, 12:29 pm, Ben wrote: > hello, I have written a parameter driven menuing and screen system for > S-Lang called SLAG.  It is very intuitive and easy to use and was > designed to rapidly build Accounting Applications with. > > I am currently working on porting it to Python. > > Which DEV g

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

2009-02-23 Thread Stef Mientki
rdmur...@bitdance.com wrote: Stef Mientki wrote: thanks Ron, 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. [snip] -Original Message- From:

Re: unescape escapes in strings

2009-02-23 Thread bvdp
MRAB wrote: bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ...

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

2009-02-23 Thread Terry Reedy
Stef Mientki wrote: thanks Ron, 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. Improving error messages is an ongoing project. I submitted feature request http

Peculiar swap behavior

2009-02-23 Thread Tim Chase
I stumbled across this oddity and was hoping folks on the list might be able to provide a little understanding: # swap scalars >>> x,y = 1,2 >>> x,y = y,x >>> x,y (2, 1) # swap lists >>> a,b = [1,2,3],[4,5,6] >>> a,b = b,a >>> a,b ([4, 5, 6], [1, 2, 3]) # swap list contents...not so much... >>

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

2009-02-23 Thread Benjamin Kaplan
On Mon, Feb 23, 2009 at 1:37 PM, Stef Mientki wrote: > rdmur...@bitdance.com wrote: > >> >> FYI, top posts are much harder to read and to reply to than if you edit >> the message to which you are replying and add your new content interleaved >> or at the bottom (as I have done). >> >> > ??? I read

Re: unescape escapes in strings

2009-02-23 Thread MRAB
bvdp wrote: MRAB wrote: bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x'

Re: Top posting

2009-02-23 Thread D'Arcy J.M. Cain
On Mon, 23 Feb 2009 19:37:17 +0100 Stef Mientki wrote: > > FYI, top posts are much harder to read and to reply to than if you edit > > the message to which you are replying and add your new content interleaved > > > ??? I read that before, but I can't understand it. It is very simple. The cri

Re: unescape escapes in strings

2009-02-23 Thread bvdp
Perfect ... thanks. >>> a = a.decode("string-escape") Using "string-escape" does the trick! Wonderful, this python. And the quick answers on this group. -- http://mail.python.org/mailman/listinfo/python-list

Re: A tale of two execs

2009-02-23 Thread Christian Heimes
bieff...@gmail.com wrote > I checked, and, for windows platform subprocess.py uses the modules > mvscrt and _subprocess, which I ham unable to > locate on my windows XP python 2.6 installation. This make the whole > thing harder, even impossible if _subprocess has > been created especially for subp

Re: Python Imaging Library (PIL): create PDF from scratch

2009-02-23 Thread Scott David Daniels
zelegolas wrote: Hi, I have some scan generated by SANE and i would like to do some transformation (like crop, brightness and resize) and finaly put all those images in PDF file. With PIL i can do all the transformations that i want. But i don't know how i can create from scratch a PDF. I'm not

Python, HTTPS (SSL), tlslite and metoda POST (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

Extending Python Questions .....

2009-02-23 Thread Ben
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 this gets run

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: A tale of two execs

2009-02-23 Thread Christian Heimes
aha wrote > def runner(cmd, stdin, stdout, ...): > try: > import subprocess > sbm = 1 > except: > sbm = 0 > > # Now do something > if sbm: > process = subporcess(...) > else: > import popen2 > process = popen2.Popen4(...) > > Has anyone else run into a situation

Re: different errors, return outside function and others

2009-02-23 Thread Tony
Thank You, I now understand what i need to do now, and again Thanks On Mon, Feb 23, 2009 at 1:57 AM, Gabriel Genellina wrote: > En Mon, 23 Feb 2009 07:07:57 -0200, Tony > escribió: > > ok thank you for that input, this is my first class in programming and its >> the only one the school offers. i

Re: Reference or Value?

2009-02-23 Thread Brian Blais
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 as i understand things, the best model is: 1 - everything

python sql query in django

2009-02-23 Thread May
I have three tables: class Technology(models.Model): technology = models.CharField(max_length=100, null=True, blank=True ) def __unicode__(self): return self.technology class Meta: ordering = ["technology"] class Publication(models.Model): pubtitle = models.TextFie

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

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' ''' word = [items] for item in it

Re: "import" not working?

2009-02-23 Thread Lionel
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 only contains > > these two modules and nothing else. The

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

2009-02-23 Thread Rob Clewley
You get None b/c that's what's being returned from your join strings function. Your function already prints out the result and doesn't return the joined strings a your usage case expects. So either return the joined strings from your function and don't print them inside the function, or vice versa

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

2009-02-23 Thread Albert Hopkins
On Mon, 2009-02-23 at 19:22 +, 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: Top posting

2009-02-23 Thread Stef Mientki
I agree that top posting on a message like this is not very convenient, but for simple messages ... D'Arcy J.M. Cain wrote: On Mon, 23 Feb 2009 19:37:17 +0100 Stef Mientki wrote: FYI, top posts are much harder to read and to reply to than if you edit the message to which you are replying an

Re: urllib2 login help

2009-02-23 Thread Joshua Kugler
You also might want to look at http://wwwsearch.sourceforge.net/mechanize/ It will do most of the hard stuff for you (sending form elements, keeping track of cookies, etc.). j john.weather...@gmail.com wrote: > Hello, > > I'm having trouble using urllib2 (maybe) when trying to log into a web >

Re: Reference or Value?

2009-02-23 Thread Christian Heimes
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 passed by > reference; We are getting down the same road every couple of months. Please do

ANN: SuPy 1.5

2009-02-23 Thread Greg Ewing
SuPy 1.5 Available -- http://www.cosc.canterbury.ac.nz/greg.ewing/SuPy/ New in this version: - Tool and Observer classes can be implemented in Python - Contextual menu facilities - Modifier key and status bar constants - to_length() function - dir() works on Ruby classes Wh

Re: Python shell scripting and errors

2009-02-23 Thread birdsong
On Feb 23, 9:34 am, Philip Semanchuk wrote: > On Feb 23, 2009, at 12:21 PM, Tim Wintle wrote: > > > On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: > >> I've got a python script running as a daemon (using someone else's > >> daemon module). It runs fine for a while, but will occasionall

ANN: Python dBase 0.84.18 released!

2009-02-23 Thread Ethan Furman
This module is designed to work with dBase III and Visual FoxPro 6.0 dbf files, along with their memo files. Index files are not supported. The table header is read into memory, table data is read into memory on first record access; field updates are immediately written to disk. Documentatio

Re: Reference or Value?

2009-02-23 Thread Denis Kasak
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 passed by >> reference; > > W

  1   2   3   >