Re: re.search (works)|(doesn't work) depending on for loop order

2008-03-22 Thread John Machin
On Mar 23, 7:27 am, sgharvey [EMAIL PROTECTED] wrote: ... and by works, I mean works like I expect it to. You haven't told us what you expect it to do. In any case, your subject heading indicates that the problem is 99.999% likely to be in your logic -- the converse would require the result of

Re: Prototype OO

2008-03-22 Thread John Machin
On Mar 23, 12:32 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: John Machin schrieb: On Mar 21, 11:48 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: [1] Just one example:http://docs.mootools.net/Class/Class.js Mootools being something a coworker might use? I don't understand the question

Re: Testing for an empty dictionary in Python

2008-03-23 Thread John Machin
On Mar 24, 2:53 am, John Nagle [EMAIL PROTECTED] wrote: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : TypeError: object of type 'bool' has no len() I presume you meant if len(dict.keys()) 0: is expensive for large dictionaries,

Re: Problems with joining Unicode strings

2008-03-23 Thread John Machin
On Mar 24, 7:58 am, Ulysse [EMAIL PROTECTED] wrote: Hello, I have problems with joining strings. My program get web page fragments, then joins them into one single web page. I have error when I try to join these fregments : UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in

Re: pydoc

2008-03-23 Thread John Machin
On Mar 24, 3:31 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sun, 23 Mar 2008 12:57:35 -0300, A Hutchison [EMAIL PROTECTED] escribió: Any known reasons why pydoc no longer works? It gets confused by many timezone changes that occur this month around the world; pydoc tries hard to

Re: List question

2008-03-23 Thread John Machin
On Mar 24, 12:19 am, Dustan [EMAIL PROTECTED] wrote: On Mar 21, 3:57 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: if 'one' and 'two' in f: alist.append(f) Use: if 'one' in f and 'two' in f: ... Personally, I would put parentheses

Re: PyTuple_Check and other type check functions didn't check the NULL pointer

2008-03-23 Thread John Machin
On Mar 24, 10:01 am, NotGuru [EMAIL PROTECTED] wrote: I was writing some C extensions for Python and use PyTupleType_Check extensively. I found that all the PySomeType_Check macros directly delegate the job to PyObject_TypeCheck(op, PyType_Type). The PyObject_TypeCheck(op, PyType_Type) is

Re: always getting 'None' return value from PyObject_CallObject

2008-03-23 Thread John Machin
On Mar 24, 10:43 am, Gal Aviel [EMAIL PROTECTED] wrote: Hello all, Kinda desperate over here .. Any help would be greatly appreciated ! I'm trying to embed a Python interpreter inside a Verilog simulator as a SystemVerilog DPI application. The python side implements a few SV exported tasks.

Re: Does python hate cathy?

2008-03-23 Thread John Machin
On Mar 24, 11:42 am, George Sakkis [EMAIL PROTECTED] wrote: On Mar 23, 8:01 pm, QS [EMAIL PROTECTED] wrote: Hi to all! I am new to python, and I encountered a weird problem. Here is my code ##8 #!/usr/bin/python # Filename: objvar.py class Person:

Re: Testing for an empty dictionary in Python

2008-03-23 Thread John Machin
On Mar 24, 11:32 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sun, 23 Mar 2008 10:45:38 -0700, Paul Rubin wrote: John Nagle [EMAIL PROTECTED] writes: What's the cheapest way to test for an empty dictionary in Python? if len(dict.keys() 0) : I like to

Re: Paramiko bugs out on windows 2003 server

2008-03-24 Thread John Machin
On Mar 25, 7:50 am, Tarun Kapoor [EMAIL PROTECTED] wrote: I am using the paramiko library to pull a data from a server using SFTP. It works perfect on a windows xp machine but bugs out a windows 2003 server. I get the following error: Traceback (most recent call last): File

Re: Shortcutting the function call stack

2008-03-24 Thread John Machin
On Mar 25, 9:05 am, Julien [EMAIL PROTECTED] wrote: Hi all, and thanks a lot for your answers! I'll try to explain a bit more what I'm after, and hopefully that will be clearer. In fact, what I'm trying to do is to hijack (I'm making up the term) a function: def hijacker(arg): if

Re: My python interpreter became mad !

2008-03-25 Thread John Machin
On Mar 25, 10:05 pm, Benjamin Watine [EMAIL PROTECTED] wrote: Yes, my python interpreter seems to became mad ; or may be it's me ! :) I'm trying to use re module to match text with regular expression. In a first time, all works right. But since yesterday, I have a very strange behaviour : $

Re: Inheritance question

2008-03-25 Thread John Machin
On Mar 25, 10:44 pm, Tzury Bar Yochay [EMAIL PROTECTED] wrote: given two classes: class Foo(object): def __init__(self): self.id = 1 def getid(self): return self.id class FooSon(Foo): def __init__(self): Foo.__init__(self) self.id = 2

Re: My python interpreter became mad !

2008-03-25 Thread John Machin
of being executed) being given the same name as a Python-included module and being executed in the current directory and hence ends up importing itself. On Tue, Mar 25, 2008 at 1:40 PM, John Machin [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Mar 25, 10:05 pm, Benjamin Watine

Re: My python interpreter became mad !

2008-03-25 Thread John Machin
we assume that? you can try setting pythonpath to some directory and put a re.py there and try from any directory starting your interpreter and importing re. and achieve the same result: importing the bogus re. What's your point? On 3/25/08, *John Machin* [EMAIL PROTECTED] mailto

Re: do 'os.path' include 'os' for us?

2008-03-27 Thread John Machin
On Mar 27, 6:41 pm, Jerry Fleming [EMAIL PROTECTED] wrote: Hi, I wrote a python script to list files in a directory but somehow did it wrongly by importing os.path instead of os. To my astonishment, it works just as charm: #!/usr/bin/python import os.path for file in os.listdir('/root/'):

Re: subtract dates with time module

2008-03-27 Thread John Machin
barronmo wrote: I'm trying to get the difference in dates using the time module rather than datetime because I need to use strptime() to convert a date and then find out how many weeks and days until that date. datetime.datetime.strptime was introduced in Python 2.5; what version are you

Re: Determine size of string in bytes

2008-03-27 Thread John Machin
On Mar 28, 6:45 am, breal [EMAIL PROTECTED] wrote: Forgive me for this question which is most likely stupid... The contents of your question are not stupid. The subject however does invite a stupid answer like: len(the_string). Disclaimer: I know nothing about SOAP except that it's usually

Re: csv Parser Question - Handling of Double Quotes

2008-03-27 Thread John Machin
On Mar 28, 7:37 am, Aaron Watters [EMAIL PROTECTED] wrote: If you want fame and admiration you could fix the arguably bug in the csv module and send the patch to the python bugs mailing list. However, I just had a perusal of csv.py good luck :). It is *NOT* a bug in the Python CSV

Re: csv Parser Question - Handling of Double Quotes

2008-03-27 Thread John Machin
On Mar 28, 8:40 am, [EMAIL PROTECTED] wrote: On Mar 27, 1:53 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 27 Mar 2008 17:37:33 -0300, Aaron Watters [EMAIL PROTECTED] escribió: this;is;a;test Resulting in an output of: ['this', 'is', 'a', 'test'] However, if I

Re: Help me on function definition

2008-03-28 Thread John Machin
On Mar 29, 12:47 pm, aeneng [EMAIL PROTECTED] wrote: Hello everyone, I am just starting to use python in numerical cacluation. I need you to help me to see what's wrong with the following piece of codes, which computes the cross product of two vectors and returns the result. u and v are two

Re: some path issues on windows

2008-03-28 Thread John Machin
On Mar 29, 1:31 pm, Brad [EMAIL PROTECTED] wrote: When reading a file into a list that contains windows file paths like this: c:\documents and settings\brad\desktop\added_software\asus\a.txt Do you mean reading a file into a list that AS A RESULT contains ...? If not, what do you mean? I

Re: problem with logic in reading a binary file

2008-03-30 Thread John Machin
On Mar 30, 3:58 pm, hdante [EMAIL PROTECTED] wrote: On Mar 29, 3:44 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I am having trouble writing the code to read a binary string. I would like to extract the values for use in a calculation. Any help would be great. I'm too

Re: xlrd and cPickle.dump

2008-04-01 Thread John Machin
[EMAIL PROTECTED] wrote: Hi all, Sorry for the repeat I needed to reform my question and had some problems...silly me. Indeed. Is omitting the traceback part of the reformation? The xlrd documentation says: Pickleable. Default is true. In Python 2.4 or earlier, setting to false will

Re: xlrd and cPickle.dump

2008-04-01 Thread John Machin
On Apr 2, 7:19 am, [EMAIL PROTECTED] wrote: How many megabytes is extremely large? How many seconds does it take to open it with xlrd.open_workbook? The document is 15mb ad 50,000+ rows (for test purposes I will use a smaller sample), 15 Mb is not large. E.g. 120 Mb is large. but my

Re: xlrd and cPickle.dump

2008-04-02 Thread John Machin
[EMAIL PROTECTED] wrote: FWIW, it works here on 2.5.1 without errors or warnings. Ouput is: 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] 0.6.1 I guess it's a version issue then... I say again: Don't guess. I forgot about sorted! Yes, that would make sense!

Re: expanding a variable to a dict

2008-04-03 Thread John Machin
On Apr 4, 8:56 am, idle [EMAIL PROTECTED] wrote: I've got a variable in a loop that I'm trying to expand/translate/ readdress as an existing dict so as to add some keys into it.. eg; I have a set of existing dicts: dictFoo, dictBar, dictFrotz (names changed to protect the innocent) now I'd

Re: python bisect questions

2008-04-03 Thread John Machin
On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote: On Apr 3, 4:24 pm, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] |I am week on functional programming, and having hard time | understanding this: | | class myPriorityQueue: | def

Re: expanding a variable to a dict

2008-04-03 Thread John Machin
On Apr 4, 9:44 am, Max M [EMAIL PROTECTED] wrote: idle skrev: now I'd like to check them all for the existence of certain default keys; ie, if the dicts don't contain the keys, add them in with default values. so, I've got: for a in ['dictFoo','dictBar','dictFrotz']: if

Re: RELEASED Python 2.6a2 and 3.0a4

2008-04-05 Thread John Machin
On Apr 5, 5:45 am, Martin v. Löwis [EMAIL PROTECTED] wrote: The Windows x86 MSI installer is missing for both 2.6 and 3.0. And likely will continue to do so for some time. Someone's got strange definitions of missing! For each there's a link on the the ptyhon.org website, and a caveat

Re: Best way to check if string is an integer?

2008-04-05 Thread John Machin
On Apr 6, 9:25 am, Mark Dickinson [EMAIL PROTECTED] wrote: On Apr 5, 6:19 pm, [EMAIL PROTECTED] wrote: which is the best way to check if a string is an number or a char? could the 2nd example be very expensive timewise if i have to check a lot of strings? You might be interested in

Re: while-loops enter the last time after condition is filled?

2008-04-05 Thread John Machin
On Apr 6, 9:53 am, [EMAIL PROTECTED] wrote: it seems to me from my results that when i use a while-loop it will execute once after the condition is met. ie the conditions is met the code executes one time more and then quits. The syntax is this: while condition: do_something()

Re: RELEASED Python 2.6a2 and 3.0a4

2008-04-06 Thread John Machin
On Apr 7, 12:50 am, Giampaolo Rodola' [EMAIL PROTECTED] wrote: On 6 Apr, 00:55, John Machin [EMAIL PROTECTED] wrote: On Apr 5, 5:45 am, Martin v. Löwis [EMAIL PROTECTED] wrote: The Windows x86 MSI installer is missing for both 2.6 and 3.0. And likely will continue to do so for some

Re: Python Data Utils

2008-04-06 Thread John Machin
On Apr 7, 12:32 am, Jesse Aldridge [EMAIL PROTECTED] wrote: Thanks for the detailed feedback. I made a lot of modifications based on your advice. Mind taking another look? Some names are a bit obscure - universify? Docstrings would help too, and blank lines I changed the name of

Re: Python Data Utils

2008-04-07 Thread John Machin
On Apr 7, 4:22 pm, Jesse Aldridge [EMAIL PROTECTED] wrote: changing ( to ( and ) to ). Changed. But then you introduced more. I attempted to take out everything that could be trivially implemented with the standard library. This has left me with... 4 functions in S.py.  1 one of them

Re: How can I use quotes without escaping them using CSV?

2008-04-09 Thread John Machin
On Apr 10, 7:39 am, Reedick, Andrew [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of jeffself Sent: Wednesday, April 09, 2008 5:11 PM To: [EMAIL PROTECTED] Subject: How can I use quotes without escaping them

Re: How can I use quotes without escaping them using CSV?

2008-04-09 Thread John Machin
On Apr 10, 9:39 am, jeffself [EMAIL PROTECTED] wrote: I set quotechar= and was able to get it to work. I'll try this at work tomorrow! setting it to what Andrew told you to do ('' not )works equally well -- http://mail.python.org/mailman/listinfo/python-list

Re: I am worried about Python 3

2008-04-09 Thread John Machin
On Apr 10, 8:12 am, Terry Reedy [EMAIL PROTECTED] wrote: jmDesktop [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Two new versions of the language are currently in development: version | 2.6, which retains backwards compatibility with previous releases; and | version 3.0, which

Re: accessing individual characters in unicode strings

2008-04-12 Thread John Machin
On Apr 12, 3:45 pm, Peter Robinson [EMAIL PROTECTED] wrote: Dear list I am at my wits end on what seemed a very simple task: I have some greek text, nicely encoded in utf8, going in and out of a xml database, being passed over and beautifully displayed on the web. For example: the most common

Re: SQLite OperationalError near ?

2008-04-12 Thread John Machin
On Apr 13, 8:45 am, Hexade [EMAIL PROTECTED] wrote: Hello I would like to use the safe ? placeholder in my SQLite requests but I got the following error: Traceback (most recent call last): (...) cursor.execute(SELECT ? FROM ? WHERE name = ? , (key, self.table, self.name))

Re: py2exe, program has stoped working!?

2008-04-13 Thread John Machin
On Apr 13, 11:52 pm, [EMAIL PROTECTED] wrote: so i used py2exe and i have the build and the dist-folders. in the distfolder there is a Calculator.exe file. when i run it it just says Calculator.exe has stopped working in a popup but the program itself never shows up. Is it a console

Re: py2exe, program has stoped working!?

2008-04-14 Thread John Machin
On Apr 14, 7:24 pm, [EMAIL PROTECTED] wrote: Is it a console program or a gui program? GUI What happens when you run it without py2exe? it works perfectly, both from within python and launching from windows Have you searched for has stopped working in (a) your source code yes no such

Re: py2exe, program has stoped working!?

2008-04-14 Thread John Machin
On Apr 15, 4:08 am, Steve Holden [EMAIL PROTECTED] wrote: John Machin wrote: By the way, popup is what you get in a web browser. What did this popup look like: a panel from your GUI software? A Windows message box? Did it have a title across the top? What was the exact text in the popup

Re: def power, problem when raising power to decimals

2008-04-16 Thread John Machin
[EMAIL PROTECTED] wrote: how do i solve power(5,1.3)? Is this a trick question? OK, I'll bite: 5 ** 1.3 8.1032829834638136 def power(nbr, po): if po==0: return 1 if po0: return nbr*power(nbr, po-1) if po0: return 1/power(nbr, -1*po) also i

Re: MySQL hardcoding?

2008-04-17 Thread John Machin
[EMAIL PROTECTED] wrote: I've got this error (see the path in last line) db=MySQLdb.connect(host='localhost',use_unicode = True, charset = Windows-1251,user='root',passwd='12',db='articulos') Can't help with the answer to your question, but this may stave off yet another question: The

Re: Request a short code review

2008-04-17 Thread John Machin
[EMAIL PROTECTED] wrote: I am not necessarily looking to make the code shorter or more functional or anything in particular. However if you spot something to improve then I am happy to learn. To give an example of what I mean I have already altered the code: def

Re: py3k s***s

2008-04-17 Thread John Machin
Diez B. Roggisch wrote: And I have been benefiting from Python in general, so far. Thanks, community. But now... I'll probably stop posting here for now, I may stop other things too. Just my 2c. You know what I was just wondering about? All these C-written cross-platform libraries

Re: get quote enclosed field in a line

2008-04-17 Thread John Machin
[EMAIL PROTECTED] wrote: is there a simple way in perl, python, or awk/shell/pipe, that gets the user agent field in a apache log? e.g. the typical line is like this: 189.139.109.235 - - [07/Apr/2008:00:00:16 -0400] GET / Periodic_dosage_dir/lacru/manara.html HTTP/1.1 200 1933 xahlee.org

Re: get quote enclosed field in a line

2008-04-17 Thread John Machin
Martin P. Hellwig wrote: Something like: # cut -d '' -f 6 httpd-access.log In Python: line.split('')[5] -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode chr(150) en dash

2008-04-18 Thread John Machin
hdante wrote: The character code in question (which is present in the page), 150, doesn't exist in ISO-8859-1. Are you sure? Consider (re-)reading all of the Wikipedia article. 150 aka \x96 doesn't exist in ISO 8859-1. ISO-8859-1 (two hyphens) is a superset of ISO 8859-1 (one hyphen) and

Re: Delete rows using xlrd?

2008-04-18 Thread John Machin
Krishna wrote: I want to delete some rows (by creating a loop may be) using xlrd. Is this possible, No. The rd in xlrd is an abbreviation for read. It is possible to read the more basic info from an Excel spreadsheet, manipulate it in memory, and write out the results to a new file using

Re: [ANN] DoIt 0.1.0 Released (build tool)

2008-04-19 Thread John Machin
Eduardo Schettino wrote: DoIt - A task execution tool (build-tool) = This is the first public release of DoIt Website: http://python-doit.sourceforge.net/ Release: DoIt 0.1.0 License: MIT About - DoIt is a build tool that focus not only

Re: random.random(), random not defined!?

2008-04-19 Thread John Machin
globalrev wrote: do i need to import something to use random? No, you need to import random -- http://mail.python.org/mailman/listinfo/python-list

Re: 2's complement conversion. Is this right?

2008-04-20 Thread John Machin
Ross Ridge wrote: Ross Ridge [EMAIL PROTECTED] wrote: It's the same as the previous version except that it precompiles the struct.unpack() format string. =A0It works similar to the way Python handles regular expressions. George Sakkis [EMAIL PROTECTED] wrote: I didn't know about the

Re: List of all Python's __special-methods__ ?

2008-04-21 Thread John Machin
Hrvoje Niksic wrote: [EMAIL PROTECTED] writes: Is there an official list of all Python's __special-methods__? http://docs.python.org/ref/specialnames.html __missing__ is missing :-) see note (10) at the bottom of http://docs.python.org/lib/typesmapping.html --

Re: module error in Vista -- works as administrator

2008-04-21 Thread John Machin
sawilla wrote: First, I'm new to Python. I'm getting and error when I run Python 2.5.2 as a regular user in Vista but not when I run Python as an administrator. For example, if I type import numpy after I launch python from an adminstrator-privileged command window it loads fine. However, from

Re: dynamically importing a module and function

2008-04-21 Thread John Machin
[EMAIL PROTECTED] wrote: Hi I have a function data['function'], that I need to import from a file data['module'], in the directory data['cwd'] OT: Any good reason for using a dictionary instead of a class instance (data.functiom, data.module, etc)? If I do this from python interactive

Re: module error in Vista -- works as administrator

2008-04-21 Thread John Machin
sawilla wrote: On Apr 21, 5:42 pm, John Machin [EMAIL PROTECTED] wrote: Log on as administrator, start python in command window and do this: import sys sys.path # shows where python is looking for importables import numpy import os.path print os.path.abspath(numpy.__file__) # shows where

Re: dynamically importing a module and function

2008-04-21 Thread John Machin
[EMAIL PROTECTED] wrote: On Mon, Apr 21, 2008 at 3:39 PM, John Machin [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: data['module'], in the directory data['cwd'] OT: Any good reason for using a dictionary instead of a class instance (data.functiom, data.module, etc)? not really, i just

Re: list manipulation

2008-04-22 Thread John Machin
Joe Riopel wrote: On Tue, Apr 22, 2008 at 4:55 PM, DataSmash [EMAIL PROTECTED] wrote: Hello, I have a list that looks like this: roadList = [Motorways,Local,Arterial] I want to apply some code so that the output looks like this: Motorways;Local;Arterial How can this be done with the

Re: list manipulation

2008-04-22 Thread John Machin
Mike Driscoll wrote: Well you could always do something like this: output = ';'.join(roadList) Which will put single quotes on the ends. No, it doesn't. You are conflating foo and repr(foo). I suppose if you want to be silly, you could do this: output = '%s' % ';'.join(roadList) *IF*

Re: Lists: why is this behavior different for index and slice assignments?

2008-04-22 Thread John Machin
John Salerno wrote: Steve Holden wrote: Assignment to a list *element* rebinds the single element to the assigned value. Ok, I understand that. Assignment to a list *slice* has to be of a list [or iterable, as per Duncan], and it replaces the elements in the slice by assigned elements.

Re: Little novice program written in Python

2008-04-25 Thread John Machin
On Apr 25, 5:44 pm, Robert Bossy [EMAIL PROTECTED] wrote: Peter Otten wrote: Rogério Brito wrote: i = 2 while i = n: if a[i] != 0: print a[i] i += 1 You can spell this as a for-loop: for p in a: if p: print p It isn't exactly equivalent, but

Re: problem with unicode

2008-04-25 Thread John Machin
On Apr 25, 9:15 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi everybody, I'm using the win32 console and have the following short program excerpt # media is a binary string (mysql escaped zipped file) print media xワユロ[ヨ ... (works) print unicode(media) UnicodeDecodeError:

Re: problem with unicode

2008-04-25 Thread John Machin
On Apr 25, 10:01 pm, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: # media is a binary string (mysql escaped zipped file) print media x???[? ... (works) Which encoding, perhaps UTF-8 or ISO8859-1? print unicode(media) UnicodeDecodeError: 'ascii'

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread John Machin
On Apr 26, 7:01 am, Joshua Kugler [EMAIL PROTECTED] wrote: OK, I'm sure the answer is staring me right in the face--whether that answer be you can't do that or here's the really easy way--but I am stuck. I'm writing an object to proxy both lists (subscriptable iterables, really) and dicts.

Re: problem with unicode

2008-04-25 Thread John Machin
On Apr 26, 6:42 am, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: John Machin wrote: On Apr 25, 10:01 pm, Bjoern Schliessmann usenet- media=x???[? print repr(media.decode(utf-8)) u'x\u30ef\u30e6\u30ed[\u30e8' (dang, KNode doesn't autodetect encodings

Re: Subclassing datetime.date does not seem to work

2008-04-25 Thread John Machin
On Apr 26, 7:43 am, Christian Heimes [EMAIL PROTECTED] wrote: Rick King schrieb: I would like to subclass datetime.date so that I can write: d = date2('12312008') I tried: from datetime import date class date2(date): def __init__( self, strng ): mm,dd,yy =

Re: How do I say Is this a function?

2008-04-26 Thread John Machin
Dan Bishop wrote: On Apr 26, 6:17 pm, John Henry [EMAIL PROTECTED] wrote: How do I determine is something a function? For instance, I don't want to relying on exceptions below: And why not? def f1(): print In f1 def f3(): print In f3 def others(): print In others for i in

pyExcelerator number formats and borders (was Re: PyExcerlerator details)

2008-04-29 Thread John Machin
A_H wrote: Hi, I'm using PyExcelerator, and it's great, If you are using the latest released version, it's not, IMO. Reading the fixed-later bug reports on Sourceforge may prompt you to get the latest version from svn. Reading the unfixed bug reports on Sourceforge may prompt you to switch

Re: RegEx for matching brackets

2008-05-01 Thread John Machin
On May 2, 9:44 am, NevilleDNZ [EMAIL PROTECTED] wrote: Below is a (flawed) one line RegEx that checks curly brackets (from awk/c/python input) are being matched. Is there a one liner for doing this in python? ThanX N re_open_close=(((\{))[^{}]*((?(0)\})))+

Re: letter frequency counter / your thoughts..

2008-05-07 Thread John Machin
On May 8, 6:00 am, [EMAIL PROTECTED] wrote: That's a great suggestion Arnaud. I'll keep that in mind next time I post code. Thanks ;) It's a suggestion for YOUR benefit, not ours. Consider keeping it in mind next time you WRITE code, whether you intend publishing it or not. --

Re: regexp help

2008-05-09 Thread John Machin
Paul McGuire wrote: from re import * Perhaps you intended import re. vowels = aAeEiIoOuU cons = bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ encodeRe = re.compile(r([%s])[%s]\1 % (cons,vowels)) print encodeRe.sub(r\1,s) This is actually a little more complex than you asked - it will search

Re: regexp help

2008-05-09 Thread John Machin
globalrev wrote: ty. that was the decrypt function. i am slo writing an encrypt function. def encrypt(phrase): pattern = re.compile(r([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])) The inner pair of () are not necessary. return pattern.sub(r1\o\1, phrase) doesnt work though, h

Re: regexp help

2008-05-09 Thread John Machin
globalrev wrote: The inner pair of () are not necessary. yes they are? You are correct. I was having a flashback to a dimly remembered previous incarnation during which I used regexp software in which something like or \0 denoted the whole match (like MatchObject.group(0)) :-) --

Re: Python, are you ill?

2008-05-10 Thread John Machin
On May 11, 6:59 am, [EMAIL PROTECTED] wrote: If you are in the interactive prompt of the Python interpreter and you do this print Testing\ or print '''Testing\''' you get three dots [...] as if Python expects a code block. If you press Enter, you get three dots again, and again, and

Re: Python doesn't recognize quote types

2008-05-10 Thread John Machin
On May 11, 6:56 am, [EMAIL PROTECTED] wrote: There's a thing that bugs me in Python. Look at this... print Testing\ SyntaxError: EOL while scanning single-quoted string Please focus on the part of the error message that states while scanning single-quoted string. How can Python claim it

Re: Find more than one error at once

2008-05-10 Thread John Machin
Diez B. Roggisch wrote: Joseph Turian schrieb: Is it possible to coax python to find more than one error at once? What kind of errors? Syntax-errors? Then use one of the python source code analyzers, such as pylint or pychecker. I don't know about pylint, but PyChecker works in a

Re: do you fail at FizzBuzz? simple prog test

2008-05-10 Thread John Machin
globalrev wrote: http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: Write a program that prints the numbers from 1 to 100. But for multiples of three print Fizz instead of the number and for the multiples of five print

Re: do you fail at FizzBuzz? simple prog test

2008-05-10 Thread John Machin
On May 11, 1:24 pm, Mensanator [EMAIL PROTECTED] wrote: On May 10, 8:12�pm, globalrev [EMAIL PROTECTED] wrote: http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: Write a program that prints the numbers from 1 to 100.

Re: do you fail at FizzBuzz? simple prog test

2008-05-12 Thread John Machin
Duncan Booth wrote: Ivan Illarionov [EMAIL PROTECTED] wrote: is there a better way than my solution? is mine ok? ['%s%s' % (not i%3 and 'Fizz' or '', not i%5 and 'Buzz' or '') or str(i) for i in xrange(1, 101)] -- Ivan or, more correctly, if you actually need to print:

Re: do you fail at FizzBuzz? simple prog test

2008-05-12 Thread John Machin
Terry Reedy wrote: Gabriel Genellina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] En Sat, 10 May 2008 22:12:37 -0300, globalrev [EMAIL PROTECTED] escribió: | (We used this question last year - some people gave a sensible answer | in less | than 5 minutes, but others did not even

Re: do you fail at FizzBuzz? simple prog test

2008-05-13 Thread John Machin
Matthew Woodcraft wrote: Gabriel Genellina [EMAIL PROTECTED] wrote: I would like to write a similar problem without this non-programming distracting issues (that is, a problem simple enough to be answered in a few minutes, that requires only programming skills to be solved, and leaving out

Re: help with file path exceeding 255 characters

2008-05-13 Thread John Machin
[EMAIL PROTECTED] wrote: I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with os.path.getsize(fullpath). fullpath = r\\LOSSSFS002\NWE_TECHNICAL\05. UK\Schiehallion (204_25a) \AmosBurke_P559\07. Technical (Subsurface)\06. Well

Re: help with file path exceeding 255 characters

2008-05-13 Thread John Machin
[EMAIL PROTECTED] wrote: On May 13, 4:38 pm, John Machin [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have trouble of obtaining the file size of a file because the fullpath exceeds 255 characters. I get this message with At the DOS command level, you can do subst x: very\long\path

Re: Python and Flaming Thunder

2008-05-13 Thread John Machin
D'Arcy J.M. Cain wrote: On Tue, 13 May 2008 19:57:10 +0300 Andrii V. Mishkovskyi [EMAIL PROTECTED] wrote: Not everybody has grown in English-speaking community, you know. And knowing math quite good, I prefer writing x = y instead of Set x to y. OMG! It's COBOL. Wasn't there an aborted

Re: Dbase / foxpro files

2008-05-15 Thread John Machin
Johny wrote: Is there a module for reading/modifing db files from Python? Thanks for help B. I have a module -- which I'm going to get around to releasing one of these days :-) -- which allows to read dBase III, dBase IV and Foxpro files (sequentially only, not randomly) and to write

Re: exists=false, but no complaint when i open it!?

2008-05-15 Thread John Machin
On May 16, 2:03 am, globalrev [EMAIL PROTECTED] wrote: print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet \trainingsetunzipped\training_set\mv_001.txt') d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- sweden.gif') d.close() exists returns false but when i

Re: file open/read/name etc, not working

2008-05-15 Thread John Machin
On May 16, 2:12 am, globalrev [EMAIL PROTECTED] wrote: import os print os.path.exists('C:/Python25/myPrograms/netflix/test.txt') d=open('C:/Python25/myPrograms/netflix/flim.txt', 'r') Two different paths again. d.readline() This reads one line and then does absolutely nothing with it. The

Re: How do I use the unpack function?

2008-05-15 Thread John Machin
On May 16, 2:11 am, Gary Herron [EMAIL PROTECTED] wrote: Marlin Rowley wrote: All: I've got a script that runs really slow because I'm reading from a stream a byte at a time: // TERRIBLE for y in range( height ): for color in range(4): for x in range( width ):

Re: Getting elements and text with lxml

2008-05-17 Thread John Machin
J. Pablo Fernández wrote: On May 17, 2:19 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Fri, 16 May 2008 18:53:03 -0300, J. Pablo Fernández [EMAIL PROTECTED] escribió: Hello, I have an XML file that starts with: vortaro art mrk=$Id: a.xml,v 1.10 2007/09/11 16:30:20 revo Exp $ kap

Re: Distributing applications that use 3rd party modules

2008-05-17 Thread John Machin
eliben wrote: Hello, I'm getting into Python now after years of Perl, and as part of my research I must understand how to do some common tasks I need. I have a bunch of Windows PCs at work to which I want to distribute an application I've developed on my PC. All these PCs have Python 2.5

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

2009-02-22 Thread John Machin
On Feb 23, 2:56 pm, Chris Cormie ccor...@aussiemail.com.au wrote: Hi, I've been Googling around on a moderately common Windows Python problem: a mismatch between the symbols a python extension thinks are available and the contents of the associated DLL. Python users running into this problem

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 ccor...@aussiemail.com.au 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

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

2009-02-23 Thread John Machin
On Feb 24, 2:54 pm, Chris Cormie ccor...@aussiemail.com.au wrote: Mark Hammond wrote: On 23/02/2009 11:41 PM, Chris Cormie wrote: If that not-very-technical description [all I've ever needed] doesn't help, you'll need to read the DW help file (HTFF1K) or wait till someone who knows what

Re: read csv error question

2009-02-24 Thread John Machin
On Feb 24, 10:42 am, rdmur...@bitdance.com wrote: Vincent Davis vinc...@vincentdavis.net wrote: I am trying to read a csv file from excel on a mac. I get the following error.SystemExit: file some.csv, line 1: new-line character seen in unquoted field - do you need to open the file in

Re: 'u' Obselete type – it is identical to 'd'. (7)

2009-02-24 Thread John Machin
On Feb 25, 4:48 am, mathieu mathieu.malate...@gmail.com wrote: I did not know where to report that: 'u'     Obselete type – it is identical to 'd'.       (7) http://docs.python.org/library/stdtypes.html#string-formatting So what's your problem with that? Do you believe that 'u' is not

Re: 'u' Obselete type – it is identical to 'd'. (7)

2009-02-24 Thread John Machin
On Feb 25, 9:06 am, Steven D'Aprano st...@pearwood.info wrote: mathieu wrote: I did not know where to report that: 'u'   Obselete type – it is identical to 'd'.         (7) http://docs.python.org/library/stdtypes.html#string-formatting Thanks If you google on python bug tracker the

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-24 Thread John Machin
On Feb 25, 11:07 am, Roy H. Han starsareblueandfara...@gmail.com wrote: Dear python-list, I'm having some trouble decoding an email header using the standard imaplib.IMAP4 class and email.message_from_string method. In particular, email.message_from_string() does not seem to properly decode

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