Re: No Content-Length header, nor length property

2015-07-08 Thread Jon Ribbens
On 2015-07-08, zljubi...@gmail.com wrote: > Why I can't get the size of this particular file? > On other servers, the same procedure would return file size in > bytes, but not for this file? > > Does it depend on server itself, or there is a way to get remote > file size before downloading? Yes,

Re: The EuroPython 2015 Keynotes

2015-07-10 Thread Jon Ribbens
On 2015-07-10, beliav...@aol.com wrote: > On Friday, July 10, 2015 at 2:58:18 PM UTC-4, Chris Angelico wrote: >> On Fri, Jul 10, 2015 at 10:01 PM, beliavsky--- via Python-list >> wrote: >> > On Friday, July 10, 2015 at 7:21:14 AM UTC-4, M.-A. Lemburg wrote: >> >> With Mandy Waite we have announce

Re: linux os.rename() not an actual rename?

2015-07-20 Thread Jon Ribbens
On 2015-07-20, Jason H wrote: > I have a server process that looks (watches via inotify) for files > to be moved (renamed) into a particular directory from elsewhere on > the same filesystem. We do this because it is an atomic operation, > and our server process can see the modify events of the f

Re: Gmail eats Python

2015-07-25 Thread Jon Ribbens
On 2015-07-25, Jussi Piitulainen wrote: > Just in case anyone cares, Gnus shows me those indentations as octal > codes, \302\240\302\240 (followed by one ASCII space). I guess a > \302\240 is a NO-BREAK SPACE in UTF-8, and I guess Gnus does not know > this because there is no charset specification

Re: Writing a module to abstract a REST api

2015-09-17 Thread Jon Ribbens
On 2015-09-17, Joseph L. Casale wrote: > I need to write a module to abstract the RabbitMQ HTTP REST api. > Before I do this, I would like to see how other projects have done > similar in the hopes I make something consistent and generic etc. > > Does anyone regularly work with a library that abst

Re: Writing a module to abstract a REST api

2015-09-17 Thread Jon Ribbens
On 2015-09-17, Joseph L. Casale wrote: >> There is https://pypi.python.org/pypi/librabbitmq ? > > Hi Jon, > That is the AMQP client that utilizes the c extensions, I am writing a > module to interact with a plugin that exposes a REST API. > > So I am not really after anyt

Re: ConnectionError handling problem

2015-09-20 Thread Jon Ribbens
On 2015-09-19, Mark Lawrence wrote: > On 19/09/2015 07:13, shiva upreti wrote: >> try: >> r=requests.post(url, data=query_args) >> except: >> print "Connection error" > > Never use a bare except in Python, always handle the bare m

Re: ConnectionError handling problem

2015-09-20 Thread Jon Ribbens
On 2015-09-20, Mark Lawrence wrote: > On 20/09/2015 13:45, Jon Ribbens wrote: >> On 2015-09-19, Mark Lawrence wrote: >>> On 19/09/2015 07:13, shiva upreti wrote: >>>>try: >>>>r=requests.post(ur

Re: ConnectionError handling problem

2015-09-20 Thread Jon Ribbens
On 2015-09-20, Chris Angelico wrote: > On Sun, Sep 20, 2015 at 10:45 PM, Jon Ribbens > wrote: >> On 2015-09-19, Mark Lawrence wrote: >>> On 19/09/2015 07:13, shiva upreti wrote: >>>> try: >>>> r=requests.post(u

Re: Cryptographically strong random numbers

2015-10-16 Thread Jon Ribbens
On 2015-10-16, Steven D'Aprano wrote: > If you have written crypto code that needs random numbers as described > below, I am looking for your feedback. > > Python-Dev is arguing about which of the following three functions should be > included: > > randbelow(end): > return a random integer in

Re: Which type should be used when testing static structure appartenance

2015-11-18 Thread Jon Ribbens
On 2015-11-18, Steven D'Aprano wrote: > On Wed, 18 Nov 2015 11:40 pm, Chris Angelico wrote: >> so I would say the choices are: Set >> literal if available, else tuple. Forget the performance. > > It seems rather strange to argue that we should ignore performance when the > whole reason for using

Re: Comparators

2015-11-21 Thread Jon Ribbens
On 2015-11-21, Cai Gengyang wrote: > Comparators, interesting ... > booltwo = (10 + 18) == 3**17 booltwo > False What's interesting about that? -- https://mail.python.org/mailman/listinfo/python-list

Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp/__init__.py contains: from flask import Flask app = Flask(__name__) Running this with 'python3 runflask

Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
On 2014-08-26, Terry Reedy wrote: > On 8/26/2014 12:03 PM, Jon Ribbens wrote: >> Flask suggests the following file layout: >> >> runflaskapp.py >> flaskapp/ >> __init__.py >> >> runflaskapp.py contains: >> >>

Re: Flask and Python 3

2014-09-23 Thread Jon Ribbens
On 2014-09-23, Juan Christian wrote: > if __name__ == '__main__': > app.run(port = 8000) app.run(port=8000, debug=True) might've made the problem easier to find. -- https://mail.python.org/mailman/listinfo/python-list

ACCU conference call for proposals

2011-09-13 Thread Jon Jagger
make 2012 another successful event. Jon Jagger Conference Chair -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrote a new library - Comments and suggestions please!

2011-09-26 Thread Jon Clements
but have a look! (I'd be willing to invest sometime with you, if you agree that's where something like this should be going...) Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrote a new library - Comments and suggestions please!

2011-09-27 Thread Jon Clements
Anyway, Robert Kern correctly interpreted me. I was not suggesting to the OP that he move to SAS (heaven forbid), I was indeed suggesting that he look into what similar systems have (that I have experience with and appreciate), and he acknowledges that is not present in Python, and ummm, take

Re: Simplest way to resize an image-like array

2011-09-30 Thread Jon Clements
On Sep 30, 5:40 pm, John Ladasky wrote: > Hi folks, > > I have 500 x 500 arrays of floats, representing 2D "grayscale" images, > that I need to resample at a lower spatial resolution, say, 120 x 120 > (details to follow, if you feel they are relevant). > > I've got the numpy, and scipy, and matplo

Re: Usefulness of the "not in" operator

2011-10-08 Thread Jon Clements
is the usefulness of the "not in" operator ? Recall what Zen of > Python tells > > There should be one-- and preferably only one --obvious way to do it. You would seriously prefer the later? Guess I'll have to start writing stuff like: 10 - 5 as 10 + -5 (as obviously the - is redundant as an operation), and 10 / 2 as int(10 * .5) or something, who needs a divide!? Jokely yours, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: PDB command <-> variable clashes

2011-10-08 Thread Jon Redgrave
f l in self.curframe.f_locals: return '!'+l if l.startswith('@'): return l[1:] return l import pdb pdb.Pdb.precmd = precmd What this does is q ->variable q if it exists else quit command @q ->always quit !q ->always variable HTH Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a file into a data structure....

2011-10-13 Thread Jon Clements
' > drawing[1][1] = '1' > drawing[1][2] = '45' > drawing[1][3] = '23' > drawing[1][4] = '27' > drawing[2] = '27' > > Sort drawing[1] from low to high > drawing[1][0] = '1' > drawing[1][1] = '5'

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Loop through a dict changing keys

2011-10-16 Thread Jon Clements
On Oct 16, 12:53 am, PoD wrote: > On Sat, 15 Oct 2011 11:00:17 -0700, Gnarlodious wrote: > > What is the best way (Python 3) to loop through dict keys, examine the > > string, change them if needed, and save the changes to the same dict? > > > So for input like this: > > {'Mobile': 'string', 'cont

Re: understand program used to create file

2011-11-01 Thread Jon Clements
the same as DaveA's. This gives you the format it was *written* in. (Saved a blank OO document as 95/97/XP Word DOC under Linux) jon@forseti:~/filetest$ file * saved-by-OO.doc: CDF V2 Document, Little Endian, Os: Windows, Version 1.0, Code page: -535, Author: jon , Revision Number: 0, Create

Re: simple file flow question with csv.reader

2011-11-02 Thread Jon Clements
h a column for filename)... it will either work or fail, then if it succeeds, start overwriting the originals - just a "select * from some_table" will do, using itertools.groupby on the filename column, changing the open() request etc... just my 2p mind you, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Get keys from a dicionary

2011-11-11 Thread Jon Clements
On Nov 11, 1:31 pm, macm wrote: > Hi Folks > > I pass a nested dictionary to a function. > > def Dicty( dict[k1][k2] ): >         print k1 >         print k2 > > There is a fast way (trick) to get k1 and k2 as string. > > Whithout loop all dict. Just it! > > Regards > > macm I've tried to underst

Re: my new project, is this the right way?

2011-11-14 Thread Jon Clements
these programs to give you the SQL that constructs tables, or makes queries etc... That'd be enough to keep you going for a couple of weeks I guess. Also, some things make more sense in a NoSQL database, so have a look at something like MongoDB or CouchDB and how their design works

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Jon Clements
: is it possible to compile Python for not using libc fopen(), > but the Posix open()? > > Thanks anyway for this hint! Have you tried/or is it possible to get your 100 or whatever files first, before your sockets? hth Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: can some one help me with my code. thanks

2012-01-20 Thread Jon Clements
yield total/count' and removing the initialization and return of num. > > -- > Terry Jan Reedy Not directing this at you Terry, and you and Tim have made fine points -- this just appears to me to be the best point at which to respond to a thread. To the OP - you have great answers, and, please note this just happens to be the way I would do this. I would separate the parsing of the data, and the calculation code out. I've whipped this up rather quickly, so it might have a few flaws but... from itertools import groupby def partition(iterable, sep=lambda L: L == 'end', factory=float): for key, vals in groupby(iterable, sep): if not key: yield map(factory, vals) # And a pure cheat, but useful if more complex calculations are required etc... (Plus covers NaN) import numpy as np print map(np.mean, partition(bin)) What you've got will work though, so wouldn't worry too much and this is just my 2p, Jon. -- http://mail.python.org/mailman/listinfo/python-list

How to go about with PDF regression

2013-02-17 Thread Jon Reyes
Hey there, so I'm trying to create automated regression for PDFs that will use Selenium RC for the generation and Python for the comparison of PDFs. I will be using pyPdf to rename the files according to their content, ImageMagick to convert the PDFs to images and PIL to actually compare the PDF

Re: How to go about with PDF regression

2013-02-17 Thread Jon Reyes
Update: Found out with the Picture Manager by Windows I could view an image 100%, use a tool that measures the windows and get a probably not accurate but still serviceable coordinate to use. I compared with the coordinates I currently have and tried to get it by the above method and the coordin

Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
So I have a dictionary and the key is a number. The values are either a single tuple or a tuple of tuples. Is there a better way to go about accessing the values of the dictionary? All the tuples contain four elements. So say: col = {"1": (0,1,2,3): "2": ((0,1,2,3),(2,3,4,5))} Then to access th

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Wow, why didn't I think of that. Thanks! I'll try it now. By the way I think I don't need to wrap the single tuples in runtime because I'm declaring that dictionary anyway beforehand and I could just do it right there. I won't be adding elements to the tuple. -- http://mail.python.org/mailman/l

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Sorry if I didn't check the code before I posted it, I just mocked it up in Google's editor. That's what Mitya suggested too, yep, I guess I just need to make it uniform to get rid of the extra checking. Thanks man! -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps are always Strings. PS: Just checked, wow

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: " so that if two key objects are equal, they stay equal, and if they differ, they stay different. " What does this mean? I won't be comparing key objects with one another. Also, when I had two

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Jon Reyes
Oh, I see, thanks! I was thinking I'll study 2.7 and once I'm comfortable with Python as a language I'll move to 3. Heck, I don't even know how to create a simple main method. -- http://mail.python.org/mailman/listinfo/python-list

PIL ImageChops.difference not working correctly(?)

2013-02-18 Thread Jon Reyes
I have two images generated from ImageMagick that I need to compare through PIL but when I compare them it says that the two images aren't identical. I tried viewing the supposed "difference" but all I see is a black image which means the two image are identical. ImageChops even returns the regi

Re: PIL ImageChops.difference not working correctly(?)

2013-02-18 Thread Jon Reyes
Wow, what the heck, I just learned that using beyond compare if I compare the two images then I'll see a different section under tolerance mode. Anyone an expert on images? The two images have whites on that same image but they're different according to BeyondCompare. What's more, if I do a bina

new-style classes multiplication error message isn't very informative

2005-12-29 Thread Jon Guyer
>>> This is a fake line to confuse the stupid top-posting filter at gmane We have a rather complicated class that, under certain circumstances, knows that it cannot perform various arithmetic operations, and so returns NotImplemented. As a trivial example: >>> class my: ... def __mul

Re: new-style classes multiplication error message isn't veryinformative

2005-12-30 Thread Jon Guyer
Steven D'Aprano REMOVETHIScyber.com.au> writes: > > On Fri, 30 Dec 2005 03:47:30 +, Jon Guyer wrote: > > > We have a rather complicated class that, under certain circumstances, knows > > that it cannot perform various arithmetic operations, and so returns >

Re: Indentation/whitespace

2006-01-11 Thread Jon Perez
Joe wrote: > Is Python going to support s syntax the does not use it's infamous > whitespace rules? I recall reading that Python might include such a > feature. Or, maybe just a brace-to-indentation preprocessor would be > sufficient. Nope never. Because that would destroy one of the most importa

Re: Indentation/whitespace

2006-01-11 Thread Jon Perez
Ilias Lazaridis wrote: >>>Is Python going to support s syntax the does not use it's infamous >>>whitespace rules? > > > Of course. > > I estimate it will take around 1 to 2 years from now, until this > whitespace-concept will become optionally. > > Backwards-compatibility will be kept, thus

Re: Indentation/whitespace

2006-01-11 Thread Jon Perez
thakadu wrote: > While I have no doubt that there are lousy browsers out there, the > problem is not only with browsers, but also I agree with you its not > Python's fault. The issue is that the code I am pasting may have used a > DIFFERENT indentation scheme, so lets say I used four spaces and th

Re: Indentation/whitespace

2006-01-14 Thread Jon Perez
Joe wrote: > As for me, I'm not suggesting that braces are better than indentation. > In fact, requiring indentation is a good idea, and I agree that braces > can be quite ugly. It is the lack of visible block closing when there's > more than one level that I dislike. > ... I'm talking about doub

json implementation

2006-07-24 Thread jon cashman
Hi everyone, Is there a doc comparing different json implementation (example: python-json, simplejson)? Does anyone have a strong recommendation to make? Any problem/issue for a particular implementation? Thanks. - jon _ Is your

RE: extender method

2006-07-26 Thread jon cashman
class S: def __init__(self, **k): self.data = k class E(S): def __init__(self, **k): S.__init__(self, **k) x = E(a=1) print x.data {'a': 1} From: [EMAIL PROTECTED] To: python-list@python.org Subject: extender method Date: 26 Jul 2006 09:21:10 -070

coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Hi listers, I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found Here's my script: results = context.module_retriever().tuples() # call to ZSQLMethod converted = [] for

Automatic email checking - best procedures/suggestions

2006-07-27 Thread Jon Clements
keep polling it every 'n' whatever for new messages, or should I be looking to the smtpd module and get mail via that? (or any other way?) I think I'm basically after the best way to implement: Email in --> Python process --> Email out Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Ahh, that did it, thanks very much. Jon - Original Message - From: <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Thursday, July 27, 2006 11:19 AM Subject: Re: coercing to Unicode: need string or buffer, NoneType found > > Jon Bowlas wrote: > >

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Ahh yes there are a couple of dodgy records that seem to have been added. many thanks. Jon - Original Message - From: "Peter Otten" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Thursday, July 27, 2006 11:22 AM Subject: Re: coercing to Unicode: need

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
It says line 8 in the traceback so I guess its result[i] = unicode(result[i], 'latin-1') Jon - Original Message - From: "Sybren Stuvel" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Thursday, July 27, 2006 11:06 AM Subject: Re: coercing to Unic

Re: How do you implement this Python idiom in C++

2006-07-27 Thread Jon Clements
> not of the derived class. > class CountedClass3 : public CountedClass {}; > Hint: where's the template parameter gone as per the previous two statements... Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you implement this Python idiom in C++

2006-07-27 Thread Jon Clements
I was simply pointing out that your statement declaring that it didn't work, wasn't accurate, because the code you'd used was incorrect. Jon -- http://mail.python.org/mailman/listinfo/python-list

Help with arrays of strings

2006-07-31 Thread Jon Smirl
ss it with zlib and finally write it to disk. The 10GB of data is Mozilla CVS when fully expanded. Thanks for any tips on how to do this. Jon Smirl [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with arrays of strings

2006-07-31 Thread Jon Smirl
arrays instead of lists. I'll code this up and give it try. Hopefully it can run though the 10GB of data in a few hours and not take days. Jon Smirl [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Initializing the number of slots in a dictionary

2006-08-06 Thread Jon Smirl
Is there some way to tell a dictionary object that I am going to load 1M objects into it and have it pre-allocate enought slots to hold all of the entries? Thus avoiding many thousand memory allocations. Jon Smirl [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Initializing the number of slots in a dictionary

2006-08-06 Thread Jon Smirl
On Sun, 06 Aug 2006 15:33:30 -0700, John Machin wrote: > Jon Smirl wrote: >> Is there some way to tell a dictionary object that I am going to load 1M >> objects into it and have it pre-allocate enought slots to hold all of >> the entries? > > Not according to the ma

Re: need an alternative to getattr()

2006-08-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > import heading1 > import heading2 > While True: > heading = get_next_heading(file_ptr) # This func will return > "heading1", then "heading2"(on next call) > if heading = "": > break > getattr(heading, "process")(file_ptr

Re: Initializing the number of slots in a dictionary

2006-08-07 Thread Jon Smirl
On Mon, 07 Aug 2006 00:33:33 -0400, Tim Peters wrote: > ... > > [Jon Smirl] >> I know in advance how many items will be added to the dictionary. Most >> dictionary implementations I have previously worked with are more >> efficient if they know ahead of time h

Re: How to reverse tuples in a list?

2006-08-08 Thread jon cashman
sorry ... i replied to sender instead of all ... so here we go again ... >>>t = [('a', 1.0), ('b',2.0),('c',3.0)] >>>t = [s[::-1] for s in t] >>>print t [(1.0, 'a'), (2.0, 'b'), (3.0, 'c')] >>> >From: "Paul McGuire" <[EMAIL PROTECTED]> >To: python-list@python.org >Subject: Re: How to reverse t

Re: IP address

2006-08-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Lad wrote: > I have a website written in Python and I would like to login every > visitor's IP address. > In other words, if a visitor come to my Python application, this > application will record his IP. Depending on what CGI framework you're using, something like:

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Jon Clements
you change the above to: class subproject: def __init__(self): configuration = { } build_steps = [ ] That'll probably be what you expect... Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Jon Clements
Jon Clements wrote: > if you change the above to: > > class subproject: > def __init__(self): > configuration = { } > build_steps = [ ] Of course, I actually meant to write self.configuration and self.build_steps; d0h! -- http://mail.python.org/mailman/listinfo/python-list

Re: Loops Control with Python

2006-10-13 Thread Jon Clements
r s2 in some_array: if s1 == s2: break Same thing, but nicer. for si in range(100 + 1): if si in some_array: # Do something here. Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: jython and toString

2006-10-16 Thread Jon Clements
method you end up calling is the toString for that temporary (not your static one). This would especially make sense if there's a version of toString which takes an object, and returns its toString result... I'm basing this purely on the fact PrintHello.toMyString() works... so take with a pinch of salt. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: making a valid file name...

2006-10-17 Thread Jon Clements
; >>> stripped = ''.join(c for c in filename if c in valid) >>> stripped 'lasfjalsfjdlasfjasfdsomethingelse.dat' If you want to replace them with something, be careful of the regex string being built (ie a space character). import re >>> re.sub(r'[^%s]' % valid,' ',filename) ' lasfjalsfjdlasfjasfd somethingelse.dat' Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension (searching for onliners)

2006-10-20 Thread Jon Clements
m looking for. If you import itertools and have your DB query return in order of service_id (or sort the list after retrieving result), then... [ [dict(service_id=key),[dict(value=n['value']) for n in value]] for key,value in itertools.groupby(result,lambda x: x['service_id']) ] ... is more or less what you want. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: why does this unpacking work

2006-10-20 Thread Jon Clements
cting like: > > for x in t: > for y,z in x: > #then it does it correctly > > But if so, why is this? It doesn't seem like very intuitive behavior. It makes perfect sense: in fact, you have kind of explained it yourself! Think of the for statement as returning the next element of some sequence; in this case it's a tuple. Then on the left side, the unpacking occurs. Using "for x in t", means that effectively no unpackig occurs, so you get the tuple. However, since the in is returning a tuple, using "for x,y in t", the tuple returned gets unpacked. Hope that helps. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: curious paramstyle qmark behavior

2006-10-20 Thread Jon Clements
(the one after the WHERE) as a string literal: so your query string is effectively "select from where 'somestring' like '%%'". I would try re-writing it like: c.execute("select from where %s like ?" % aColumn, "%" + sys.argv[1] + "%") I don't use mx.ODBC, and definately don't use Access (gagging sounds... but if you're stuck with it, so be it)... hth, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: curious paramstyle qmark behavior

2006-10-21 Thread Jon Clements
BartlebyScrivener wrote: > Thanks, Jon. > > I'm moving from Access to MySQL. I can query all I want using Python, > but so far haven't found a nifty set of forms (ala Access) for easying > entering of data into MySQL. My Python is still amateur level and I'm &

Re: curious paramstyle qmark behavior

2006-10-21 Thread Jon Clements
BartlebyScrivener wrote: > Jon Clements wrote: > > > if your load on the data-entry/browsing side isn't too heavy, you can > > use the 'development server' instead of installing a full-blown server > > such as Apache (I'm not sure if IIS is supported)

Re: can't open word document after string replacements

2006-10-24 Thread Jon Clements
7;ve noted, this is binary data so you can't assume anything about it. Doing it this way is a Bad Idea (tm). If you want to do something like this, why not use templated HTML, or possibly templated PDFs? Or heaven forbid, Word's mail-merge facility? (I think MS Office documents are effectively self-contained file systems, so there is probably some module out there which can read/write them). Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ctypes Error: Why can't it find the DLL.

2006-10-25 Thread Jon Clements
them. I'm guessing it's worked before because you've been lucky. Works fine!: >>> 'C:\winnt\system32\smtpctrs.dll' 'C:\\winnt\\system32\\smtpctrs.dll' Uh oh, escaped: >>> 'C:\winnt\system32\arapi51.dll' 'C:\\winnt\\system32\x07rapi51.dll' Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: dict problem

2006-10-25 Thread Jon Clements
roperly. For instance, it looks like FCas exists somewhere as it's barfing on trying to find C. Where is XDS defined etc...? I can't see updateDS1v() ever completing: any Fxas passed in not equal to 0 will repeat indefinately. I'm guessing unless C is meant to be a variable, you me

Re: dict problem

2006-10-25 Thread Jon Clements
Alistair King wrote: > Jon Clements wrote: > > > > Alistair King wrote: > > > > > > > > > >> >> Hi, > >> >> > >> >> ive been trying to update a dictionary containing a molecular formula, > >> &

Re: newbie class-building question

2006-11-09 Thread Jon Clements
the code and tried googling this error message but am > having difficulty finding the source of the problem. > > Many thanks > > Jon > > class myList: > def __init__ (self,value=[]): > self.wrapped=[] > for x in value : > sel

Re: newbie class-building question

2006-11-09 Thread Jon Clements
her): return self.wrapped, other # def __add__(self,other): return self + other hth Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: extract text from a string

2006-11-09 Thread Jon Clements
est the best method would be string_name[1:-1] and that you don't need a regex. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: generating random passwords ... for a csv file with user details

2006-05-28 Thread Jon Clements
eld then row[3] = password out_csv.writerow(row) All the best, Jon. k.i.n.g. wrote: > Hi ALL, > > I am sorry for not mentioning that I am new to python and scripting. > How can I add the above script to handle csv file. I want the script to > generate passwords in the passwords

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
be corrected though); to stop the implicit newline use something like print 'testing', >>> 'testing' (but - with the leading comma, the newline is suppressed) I personally find that print is convenient for sentences (or writing 'lines'). Thought it worth point

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
I meant 'trailing': not leading. mea culpa. Jon. Jon Clements wrote: > Didn't know of the >> syntax: lovely to know about it Bruno - thank > you. > > To the OP - I find the print statement useful for something like: > print 'this','is',&#

Re: How to generate k+1 length strings from a list of k length strings?

2006-06-08 Thread Jon Clements
Are you asking the question, "Which pairs of strings have one character different in each?", or "Which pairs of strings have a substring of len(string) - 1 in common?". Jon. Girish Sahani wrote: > I have a list of strings all of length k. For every pair of k length &

Re: Select hangs after some reads

2006-06-08 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steve Holden wrote: > Of course, if the client forces the TCP PSH flag true then the receiver > is guaranteed to debuffer the stream up to that point - this is how FTP > clients work, for example. I don't think that's right. You are confusing the PSH flag (which i

Re: Select hangs after some reads

2006-06-08 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steve Holden wrote: >> I don't think that's right. You are confusing the PSH flag (which is >> basically unused in Unix networking I think) and the URG flag (which >> is extremely rarely used, but is indeed used by FTP to get abort >> requests to 'jump the queue' as

Re: "groupby" is brilliant!

2006-06-13 Thread Jon Clements
mportant May not be applicable in your case, but has stung me a few times... All the best, Jon. Frank Millman wrote: > Paul McGuire wrote: > > > > > > reader = csv.reader(open('trans.csv', 'rb')) > > > rows = [] > > > for row in reader: >

Re: __cmp__ method

2006-06-14 Thread Jon Clements
doing what you're doing, but something about builtin types, and there's a UserString module... Hope that helps a bit anyway, Jon. JH wrote: > Hi > > Can anyone explain to me why the following codes do not work? I want to > try out using __cmp__ method to change the sorting

Re: Iteration over recursion?

2006-06-20 Thread Jon Clements
each function in term (which in most cases - I would imagine fits on the stack), so although it's doing effectively the same thing, it's doing so with less memory. I probably haven't explained too well, and I may not even be right. So take with a pinch of salt. All the best, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteration over recursion?

2006-06-20 Thread Jon Clements
gt; Sudden Disruption > -- > Sudden View... > the radical option for editing text > http://www.sudden.net/ > http://suddendisruption.blogspot.com Just my little rant, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteration over recursion?

2006-06-20 Thread Jon Clements
/ASPN/Cookbook/Python/Recipe/496691 > > Regards, > Kay Interesting. Thanks Kay. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: help() on stdout.closed

2006-06-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Pekka Karjalainen wrote: from sys import stdout help (stdout.closed) > > If I do this, it gives me help on the bool object. stdout.closed is a bool. What were you expecting it to show you? -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to wrap a whole script in try..except?

2006-06-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Hari Sekhon wrote: > I want to wrap a whole script in try ... except. What is the best way of > doing this? You could do this maybe: import sys def excepthook(exc_type, exc_value, tb): import modules_needed_to_notify_exception ... sys.excepthook =

Re: OS specific command in Python

2006-06-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >> So basically, instead of typing in on the command line argument I want >> to have it in a python program and let it do the action. > > Try exec() and execfile() from the standard library (IIRC) Ths os.spawn...() functions are likely to b

Re: error with string (beginner)

2006-06-25 Thread Jon Clements
ctly what you need when writing a quick script for expert use.) If the readline module was loaded, then input() will use it to provide elaborate line editing and history features. Consider using the raw_input() function for general input from users. """" So you want be using raw_input() for starters... Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Extending built-in objects/classes

2006-07-03 Thread Jon Clements
tly called, or do I need to call str's __init__ in mystr's (I seem to remember seeing some code which did this, as well as calling super()). Any critiscm is appreciated. Many thanks, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending built-in objects/classes

2006-07-03 Thread Jon Clements
nction, so you dont need one. If you have multiple > inheritance, however, you must include an __init__ which calls the > __init__ on every parent, otherwise only the first parent's gets > called. Thanks for your post: it's most appreciated. Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending built-in objects/classes

2006-07-03 Thread Jon Clements
the physical representation and not the external appearance, how would I do this? Or, would self, always return internal representation, (if so, how would I get external appearance?). Or I could be talking complete _beep_ - in which case I apologise. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sudoko solver

2006-07-04 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Rony Steelandt wrote: > Yes, this is on windows using winzip > It says the zip file is not a valid zipfile Works fine for me on Windows. Try deleting the file you downloaded, clearing your browser cache, and trying again. On the other hand, when you run it it immed

<    1   2   3   4   5   6   7   8   9   10   >