Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Fredrik Lundh
Fredrik Lundh wrote: > while Townshps is not None: or rather, while Townshp is not None: since that's the variable you're using later on. -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Fredrik Lundh
Mark Peters wrote: > However, the typical Python way to iterate through a list for be to > use a for loop. Perhaps replace the while statement with: > for Townshp in Townshps: > and remove the "Townshp = Townshps.next()" lines that assumes that the feature class list is actually a Python iterab

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi. > > I'm extremely new to Python and programming as a whole. I have written > a python script with the assistance of ESRI ArcGIS 9.2, which uses > Python 2.4.1, however, it gives me this error when I try to run it. Please post the full traceback. It's meant to he

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > [EMAIL PROTECTED] a écrit : > > 4/ the Python 'for' loop is meant to iterate over an iterable and taking > care of boundaries, so you'd be better using it: > > townships = gp.ListFeatureClasses ("*") > for township in townships: > doSomethingWith(township) Actu

Re: merits of Lisp vs Python

2006-12-20 Thread Anders J. Munch
Rob Thorpe wrote: > Anders J. Munch wrote: >> Really? So how do you write a portable program in CL, that is to >> run for unbounded lengths of time? > > You can't. > > The thing about the spec not defining GC is almost a bit of humour. > No-one would use an implementation with no GC. > >

Re: perl better than python for users with disabilities?

2006-12-20 Thread johnzenger
Blind programmers can use braille displays, which let them perceive indentation as easily as sighted programmers can. http://xrl.us/tydj As for people with physical disabilities that have trouble typing, a Python-aware editor does the identation for you, so all you have to do is type a colon and

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread thompson . marisa
I've had a lot of replies suggesting different things. These are the results: When I change while Townshps !="": to while Townshp is not None: and when I change while Townshps !="": to for Townshp in iter(gp.ListFeatureClasses().next, None): They both work perfectly, and it solved my problem.

Re: error with IDLE on debian

2006-12-20 Thread johnzenger
Just a guess, but I think you need to be using at least Python 2.4 if you are going to use IDLE version 2.4.4-2. On Dec 20, 1:16 pm, altern <[EMAIL PROTECTED]> wrote: > Hi > > when i try to run IDLE on my debian laptop I get this error. > > $ idle > Traceback (most recent call last): >File "/u

Re: TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread Carsten Haese
On Wed, 2006-12-20 at 11:33 -0800, Mark Peters wrote: > Warning: I know nothing about the Python ArcGIS stuff. > > The first thing that jumps out at me is your while condition. You are > testing "Townshps" when it seems from the code that you should be > testing "Townshp". However, the typical P

Re: merits of Lisp vs Python

2006-12-20 Thread Rob Thorpe
Anders J. Munch wrote: > Rob Thorpe wrote: > > Anders J. Munch wrote: > >> Really? So how do you write a portable program in CL, that is to > >> run for unbounded lengths of time? > > > > You can't. > > > > The thing about the spec not defining GC is almost a bit of humour. > > No-one woul

Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Giovanni Bajo
Robin Becker wrote: > I just tried this on something which we currently use py2exe+nsis to > package and it certainly seems to produce a small exe, but when run I > see a cryptic message on two message boxes > > ! msvcr71.dll > > ! could not be extracted > > the program then exits. yeah that

new Python-Ideas mailing list

2006-12-20 Thread [EMAIL PROTECTED]
At Guido's suggestion, a new mailing list has been created named Python-Ideas (http://mail.python.org/mailman/listinfo/python-ideas). This list is meant as a place for speculative, pie-in-the-sky language design ideas to be discussed and honed to the point of practically being a PEP before being pr

Re: using methods base64 module in conjunction with Crypto.Hash.SHA256

2006-12-20 Thread Klaas
[EMAIL PROTECTED] wrote: > I am attempting to implement a process, and I'm pretty sure that a > major roadblock is that I do not understand the nomenclature. The > specs indicate that the goal is to calculate a message digest using an > SHA-256 algorithm. There are 2 examples included with the s

Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Robin Becker
Giovanni Bajo wrote: > yeah that's pretty cryptic. It's a known bug which I need to come around > and fix it. Anyway, the message itself is harmless: if the program then > exits, there is *another* problem. > > If you want to help with that, you could enable the console+debug mode > an

Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Robin Becker
Giovanni Bajo wrote: > yeah that's pretty cryptic. It's a known bug which I need to come around > and fix it. Anyway, the message itself is harmless: if the program then > exits, there is *another* problem. > > If you want to help with that, you could enable the console+debug mode > an

Re: perl better than python for users with disabilities?

2006-12-20 Thread Steven D'Aprano
On Thu, 21 Dec 2006 00:11:10 +0800, Dan Jacobson wrote: > Can I feel even better about using perl vs. python, as apparently > python's dependence of formatting, indentation, etc. vs. perl's > "(){};" etc. makes writing python programs perhaps very device > dependent. I can't think of what sort of

ANN: Pygments 0.6 "Zimtstern" released

2006-12-20 Thread Georg Brandl
I'm happy to announce the second public release of Pygments, the generic Python syntax highlighter. Download it from , or look at the demonstration at . News The new features since 0.5.1 include: * New lexers: S

what is wrong with my code?

2006-12-20 Thread Pyenos
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS=["new","remove","modify"] DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=["pass", "fail"] def unpickleProgressTable(pickled_progress_data_file):

glibc detected double free or corruption

2006-12-20 Thread Grant Edwards
When I try to run pycadia I get the following error message as soon as I click "start game" *** glibc detected *** python: double free or corruption (out): 0xbff43b10 *** Then the program locks up and has to be killed with a SIGKILL. pycadia is a

Tkinter, StringVar and dict

2006-12-20 Thread Kevin Walzer
I'm trying to manage user preferences in a Tkinter application by initializing some values that can then be configured from a GUI. The values are set up as a dict, like so: self.prefs= { 'interface': '-en1', 'verbose': '-v', 'fontname': 'Courier',

Re: merits of Lisp vs Python

2006-12-20 Thread jayessay
"Anders J. Munch" <[EMAIL PROTECTED]> writes: > jayessay wrote: > > Please note: GC is not part of CL's definition. It is likely not part > > of any Lisp's definition (for reasons that should be obvious), and for > > the same reasons likely not part of any language's definition. > > Really? R

Re: what is wrong with my code?

2006-12-20 Thread Calvin Spealman
It is hard to determine what is wrong with your code without you telling anyone why it is you believe something is wrong with it. Did you get an exception? Did it simply not do what it was expected to do? There seems to be some apparent indenting problems, but maybe that is just from pushing it thr

Re: what is wrong with my code?

2006-12-20 Thread Fredrik Lundh
Pyenos wrote: > could someone tell me what things are wrong with my code? do you want a free code review, or do you have problems with the code and just forgot to mention what they are? -- http://mail.python.org/mailman/listinfo/python-list

Re: def index(self):

2006-12-20 Thread Gert Cuykens
> > class HelloWorld(object): > > @cherrypy.exposed > > def index(self): > >return "Hello World" do i have to write @cherrypy.exposed before every def or just once for all the def's ? and why not write something like @index.exposed ? in other words i have no idea what @ actually d

RE: glibc detected double free or corruption

2006-12-20 Thread Delaney, Timothy (Tim)
Grant Edwards wrote: > When I try to run pycadia > > I get the following error message as soon as I click "start game" > > *** glibc detected *** python: double free or corruption (out): > 0xbff43b10 *** > > Then the program locks up and has to

Re: def index(self):

2006-12-20 Thread George Sakkis
Gert Cuykens wrote: > > > class HelloWorld(object): > > > @cherrypy.exposed > > > def index(self): > > >return "Hello World" > > do i have to write @cherrypy.exposed before every def or just once for > all the def's ? and why not write something like @index.exposed ? > > in other wo

calling a class instance of function

2006-12-20 Thread Pyenos
class pid: "pid" def add(original_pid,toadd): "add pid" original_pid.append(toadd) return original_pid def remove(something_to_remove_from,what): "remove pid" something_to_remove_from.remove(what) return something_to_remove_from def m

Re: what is wrong with my code?

2006-12-20 Thread Pyenos
"Calvin Spealman" <[EMAIL PROTECTED]> writes: > It is hard to determine what is wrong with your code without you > telling anyone why it is you believe something is wrong with it. Did > you get an exception? Did it simply not do what it was expected to do? > There seems to be some apparent indenti

TypeError: unbound method must be called with class instance 1st argument

2006-12-20 Thread void . no . spam . com
I'm a novice at Python, and found some code samples on how to use threads. My script is being run by a product that contains a Jython interpreter. Can someone please explain why I get the following error: Traceback (innermost last): File "/full/path/to/file/GenerateData.py", line 104, in ? F

Re: calling a class instance of function

2006-12-20 Thread Brett Hoerner
Pyenos wrote: > class test(pid): > pid.original=[1,2,3] > pid.toadd=4 > pid.add(pid.original,pid.toadd) # error here says that > # it expects pid instance as first arg > # not a list that it got. > > why do i get an

Re: TypeError: unbound method must be called with class instance 1st argument

2006-12-20 Thread Matimus
> Can someone please explain why I get the following error: The following line: threading.Thread.__init__() Should be written as: threading.Thread.__init__(self) -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple.index()

2006-12-20 Thread greg
Nick Maclaren wrote: > Not at all. I didn't say that they came in pairs. Consider: > > [str1, str2, agent1, str3, agent2, agent3, agent4, str4, ...] That's homogeneous. Any item of the list can be either a string or an agent, and the only thing the position in the list affects is what orde

Re: calling a class instance of function

2006-12-20 Thread Brett Hoerner
Brett Hoerner wrote: > Also, in order to call a function without arguments you still need to > use (), so you probably wanted to use pid.original() in your pid.add > call. Sorry, never mind this bit, I misread the line. But you do probably want to change the class test into a function test. Bret

Re: TypeError: unbound method must be called with class instance 1st argument

2006-12-20 Thread void . no . spam . com
Matimus wrote: > > Can someone please explain why I get the following error: > > The following line: > threading.Thread.__init__() > Should be written as: > threading.Thread.__init__(self) Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, StringVar and dict

2006-12-20 Thread James Stroud
Kevin Walzer wrote: > I'm trying to manage user preferences in a Tkinter application by > initializing some values that can then be configured from a GUI. The > values are set up as a dict, like so: > > self.prefs= { > 'interface': '-en1', > 'verbose': '-v', >

Re: Tkinter, StringVar and dict

2006-12-20 Thread James Stroud
Kevin Walzer wrote: > I'm trying to manage user preferences in a Tkinter application by > initializing some values that can then be configured from a GUI. The > values are set up as a dict, like so: > > self.prefs= { > 'interface': '-en1', > 'verbose': '-v', >

Re: Tkinter, StringVar and dict

2006-12-20 Thread James Stroud
Kevin Walzer wrote: > I'm trying to manage user preferences in a Tkinter application by > initializing some values that can then be configured from a GUI. The > values are set up as a dict, like so: > > self.prefs= { > 'interface': '-en1', > 'verbose': '-v', >

Re: what is wrong with my code?

2006-12-20 Thread Gabriel Genellina
At Wednesday 20/12/2006 19:16, Pyenos wrote: could someone tell me what things are wrong with my code? My crystal ball is at the repair shop - could you please tell us: - what do you expect the code to do? - what do you get instead? - any compiler error messages you see? - in case of an except

Re: Support of IPv6 extension headers

2006-12-20 Thread cychong
Thanks for your reply. BTW, is there any way to send the packet with the IPV6 extension header w/o using sendmsg? Chae-yong Jean-Paul Calderone wrote: > On 20 Dec 2006 07:07:02 -0800, cychong <[EMAIL PROTECTED]> wrote: > >Hi, > > > >There is no probleming in programming the basic IPv6 socket prog

Re: what is wrong with my code?

2006-12-20 Thread Carl Banks
Pyenos wrote: > "Calvin Spealman" <[EMAIL PROTECTED]> writes: > > On 21 Dec 2006 09:16:58 +1100, Pyenos <[EMAIL PROTECTED]> wrote: > > > import cPickle, shelve > > > > > > could someone tell me what things are wrong with my code? > > > > > > class progress: > > > > > > PROGRESS_TABLE_ACTIONS=[

pickle fun

2006-12-20 Thread Pyenos
class pickle_service: import cPickle as p # accept list as arg then serialize it to a file def serialize(some_list,picklefile): f=file(picklefile,"w") p.dump(some_list,f) # so dumped this shit to the file f.close() # which one

Re: what is wrong with my code?

2006-12-20 Thread Pyenos
thanks for your point. so because i have said class blah: i must explicitly say self for every instantiation of object? -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle fun

2006-12-20 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > class pickle_service: > import cPickle as p > > # accept list as arg then serialize it to a file > def serialize(some_list,picklefile): > f=file(picklefile,"w") > p.dump(some_list,f) # so dumped this shit to the

Re: what is wrong with my code?

2006-12-20 Thread Carl Banks
Pyenos wrote: > thanks for your point. so because i have said class blah: i must > explicitly say self for every instantiation of object? http://docs.python.org/tut/ Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: what is wrong with my code?

2006-12-20 Thread rzed
Pyenos <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > thanks for your point. so because i have said class blah: i must > explicitly say self for every instantiation of object? > No, for every method within the class. Given: class Blah(object): def method1(self,arg1):

Re: calling a class instance of function

2006-12-20 Thread Julio Biason
On Wed, December 20, 2006 22:09, Pyenos wrote: > class pid: > "pid" > def add(original_pid,toadd): [...] > def remove(something_to_remove_from,what): [...] > def modify(source,element,changewiththis): [...] > why do i get an error? Did you copy'n'pasted the code here or typed it d

list1.append(list2) returns None

2006-12-20 Thread Pyenos
def enlargetable(table,col): return table.append(col) def removecolfromtable(table,col): return table.remove(col) print enlargetable([[1],[2],[3]],[4]) # returns None Why does it return None instead of [[1],[2],[3],[4]] which I expected? -- http://mail.python.org/mailman/listinfo/python

Re: Good Looking UI for a stand alone application

2006-12-20 Thread Vincent Delporte
On Tue, 19 Dec 2006 08:15:18 -0600, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >There's a few more caveats I haven't addressed, and there are places >where wx isn't perfect. BTW, do you know of a good article/book on writing cross-platform GUI apps, with recommendations, pitfalls, etc. especially

Re: list1.append(list2) returns None

2006-12-20 Thread Todd Neal
Pyenos wrote: > def enlargetable(table,col): > return table.append(col) > > def removecolfromtable(table,col): > return table.remove(col) > > print enlargetable([[1],[2],[3]],[4]) # returns None > > Why does it return None instead of [[1],[2],[3],[4]] which I expected? append modifies the

Re: list1.append(list2) returns None

2006-12-20 Thread Edward Kozlowski
Pyenos wrote: > def enlargetable(table,col): > return table.append(col) > > def removecolfromtable(table,col): > return table.remove(col) > > print enlargetable([[1],[2],[3]],[4]) # returns None > > Why does it return None instead of [[1],[2],[3],[4]] which I expected? return the table.

Re: calling a class instance of function

2006-12-20 Thread Gabriel Genellina
On 20 dic, 21:09, Pyenos <[EMAIL PROTECTED]> wrote: > class pid: > "pid" > def add(original_pid,toadd): > "add pid" > original_pid.append(toadd) > return original_pid For a method, you have to include an *explicit* first parameter (usually called "self") that refers

Re: Using difflib to compare text ignoring whitespace differences

2006-12-20 Thread Gabriel Genellina
On 19 dic, 11:53, Neilen Marais <[EMAIL PROTECTED]> wrote: > Hi > > I'm trying to compare some text to find differences other than whitespace. > I seem to be misunderstanding something, since I can't even get a basic > example to work: > > In [104]: d =difflib.Differ(charjunk=difflib.IS_CHARACTER_J

Re: list1.append(list2) returns None

2006-12-20 Thread Gabriel Genellina
> > def enlargetable(table,col): > > return table.append(col) Google for "python pitfalls" -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Does any one know of any good folder/directory modules

2006-12-20 Thread weir
"[EMAIL PROTECTED] 写道: " > Hi > > Does any one know of any good folder/directory modules. I need to be > able to see what files and directories are in a folder, I also need to > be able to see the size of the directory content. > > Thanks This one is more convenient: http://www.jorendorff.com/art

Re: list1.append(list2) returns None

2006-12-20 Thread Ben Finney
Pyenos <[EMAIL PROTECTED]> writes: > def enlargetable(table,col): > return table.append(col) > > def removecolfromtable(table,col): > return table.remove(col) > > print enlargetable([[1],[2],[3]],[4]) # returns None > > Why does it return None instead of [[1],[2],[3],[4]] which I expected?

ANN: M2Crypto 0.17

2006-12-20 Thread Heikki Toivonen
M2Crypto is the most complete Python wrapper for OpenSSL. Homepage: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto Changes in 0.17: - setup.py has new test command to run unit tests (requires setuptools) - Added m2urllib2, by James Bowes (python 2.4 and later, at least for now) - Ad

Re: list1.append(list2) returns None

2006-12-20 Thread Steven D'Aprano
On Thu, 21 Dec 2006 16:29:01 +1100, Ben Finney wrote: > Pyenos <[EMAIL PROTECTED]> writes: > >> def enlargetable(table,col): >> return table.append(col) >> >> def removecolfromtable(table,col): >> return table.remove(col) >> >> print enlargetable([[1],[2],[3]],[4]) # returns None >> >> Wh

Re: Support of IPv6 extension headers

2006-12-20 Thread Martin v. Löwis
cychong schrieb: > BTW, is there any way to send the packet with the IPV6 extension header > w/o using sendmsg? That depends on your operating system. Find out whether your operating system supports that; if it does, it is easy to tell whether that is exposed in Python or not. Regards, Martin --

Re: merits of Lisp vs Python

2006-12-20 Thread Ken Tilton
[EMAIL PROTECTED] wrote: > Come on; you guys can't just leave this at 999 posts! > Funny you should whine, i was just getting ready to sign off with: I noticed while singing the praises of auto-indentation that there was a shortcoming in The Greatest Feature Known to Editing source code, whic

Re: Fall of Roman Empire

2006-12-20 Thread Hendrik van Rooyen
"Thomas Ploch" <[EMAIL PROTECTED]> wrote: > Ben Finney schrieb: > > "John Machin" <[EMAIL PROTECTED]> writes: > > > >> Ben Finney wrote: > >> > >>> \ "...one of the main causes of the fall of the Roman Empire was | > >>> `\that, lacking zero, they had no way to indicate successfu

Re: tuple.index()

2006-12-20 Thread Hendrik van Rooyen
"Nick Maclaren" <[EMAIL PROTECTED]> wrote: > Not at all. I didn't say that they came in pairs. Consider: > > [str1, str2, agent1, str3, agent2, agent3, agent4, str4, ...] > > See Algol 68 for an example of this. When I looked at the above, I went "tilt" - If you had no a priori knowledge

Re: your opinion about psycopg vs pygresql

2006-12-20 Thread johnf
Martin P. Hellwig wrote: > Hi all, > > I'm playing a bit with PostgreSQL, in which I've set me the target to > create a python script which with user input creates a new user role and > a database with that owner (connecting to template1 since I know that at > least that db exists). > > Ok so I

a question on python dict

2006-12-20 Thread could . net
Python dict is a hash table, isn't it? I know that hashtable has the concept of "bucket size" and "min bucket count" stuff, and they should be configurable so I can set them to the proper value when I know how many items I'm going to handle. If these two values can't be set, the hashtable will gi

Re: a question on python dict

2006-12-20 Thread Tim Peters
[EMAIL PROTECTED] > Python dict is a hash table, isn't it? Yup. > I know that hashtable has the concept of "bucket size" and "min bucket > count" stuff, Some implementations of hash tables do. Python's does not. Python's uses what's called "open addressing" instead. > and they should be confi

Re: a question on python dict

2006-12-20 Thread could . net
Thank you very much for your explanation! I made a mistake that I said the hash value should be recalculated each time the dict resize, what I wanted to say was that the position of each item should be recalculated. Maybe I should take a look at the source code of python dict some day. I'll some

rsync for python?

2006-12-20 Thread nienfeng
Hi, everyone I want to build rsync server that can run in linux and windows, and configure by python. So I'm looking for something like rsync for python. I find rsync.py and pysync. But rsync.py looks like a client mode, it can't be a rsync server, is it? Can pysync be a rsync server? T

<    1   2