[issue12067] Doc: remove errors about mixed-type comparisons.

2011-05-12 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12067 ___ ___ Python-bugs-list

[issue12029] ABC registration of Exceptions

2011-05-08 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12029 ___ ___ Python-bugs-list

Re: Stuck with urllib.quote and Unicode/UTF-8

2011-05-07 Thread Chris Rebert
On Sat, May 7, 2011 at 5:35 AM, Marian Steinbach mar...@sendung.de wrote: An addition/correction: It seems as if my input variable address is not Unicode. This is what I get for print [address]: ['K\xf6ln, Nordrhein-Westfalen'] Isn't this utf-8 encoding? Nope, it's Latin-1 (or similar,

Re: Custom string joining

2011-05-07 Thread Chris Rebert
On Sat, May 7, 2011 at 5:31 AM, Claudiu Popa cp...@bitdefender.com wrote: Hello Python-list, I  have  an object which defines some methods. I want to join a list or an iterable of those objects like this: new_string = |.join(iterable_of_custom_objects) What   is   the   __magic__  function

Re: ABC-registered Exceptions are not caught as subclasses

2011-05-07 Thread Chris Rebert
On Sat, May 7, 2011 at 12:03 PM, andrew cooke and...@acooke.org wrote: This isn't hugely surprising, but doesn't seem to be documented.  Is it a bug, or worth raising as one, or have I misunderstood? Python 3.2 (r32:88445, Feb 27 2011, 13:00:05) [GCC 4.5.0 20100604 [gcc-4_5-branch revision

Re: checking if a list is empty

2011-05-06 Thread Chris Rebert
On Thu, May 5, 2011 at 11:36 PM, Jabba Laci jabba.l...@gmail.com wrote: Hi, If I want to check if a list is empty, which is the more pythonic way? Option (2), IMO. li = [] (1) if len(li) == 0: ... FYI, also equivalent: if not len(li): ... or (2) if not li: Cheers, Chris --

Re: string formatting

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 1:46 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 06 May 2011 10:00:30 +0200, Web Dreamer wrote: Jabba Laci a écrit ce vendredi 6 mai 2011 09:18 dans mailman.1229.1304666321.9059.python-l...@python.org : Hi, Which is the preferred way of

Re: seems like a bug in isinstance()

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 2:24 AM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I've created a class Point in file .../openopt/kernel/Point.py Consider the code in file .../somewhere/file1.py from openopt.kernel.Point import Point p = Point() now let's pass p into a func from

Re: if statement multiple or

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 4:02 AM, Albert Hopkins mar...@letterboxes.org wrote: On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: Hi, I am trying to write a script and I realised that I need to use something like if ('a' or 'b' or 'c')  not in line:    print line The expression:  

Re: Python 3 dict question

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 12:40 PM, dmitrey dmitre...@gmail.com wrote: hi all, suppose I have Python dict myDict and I know it's not empty. I have to get any (key, value) pair from the dict (no matter which one) and perform some operation. In Python 2 I used mere key, val = myDict.items()[0]

Re: checking if a list is empty

2011-05-06 Thread Chris Rebert
On Fri, May 6, 2011 at 1:05 PM, Adam Tauno Williams awill...@whitemice.org wrote: snip - and ignore the Pythonistas [they're nuts;  that x.count() doesn't work is amazingly stupid]. Eh? It works fine. [5, 2, 2, 1, 2].count(2) == 3. If you mean you want len(x) to be spelled x.count(), that's

Re: access to some text string in PDFs

2011-05-05 Thread Chris Rebert
On Thu, May 5, 2011 at 2:26 PM, Robert Pazur pazurrob...@gmail.com wrote: Dear all, i would like to access some text and count the occurrence as follows I got a lots of pdf with some scientific articles and i want to preview  which words are usually related with for example determinants as

Re: Py_XDECREF/Py_DECREF evaluating its argument more than once

2011-05-05 Thread Chris Rebert
On Thu, May 5, 2011 at 5:59 PM, Chris Angelico ros...@gmail.com wrote: snip Since inline functions are a part of C99 as well as C++, would it be possible to have configure.sh detect its availability and optionally use that instead of preprocessor macros, or would this run the risk of

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Chris Rebert
On Tue, May 3, 2011 at 9:31 AM, Dun Peal dunpea...@gmail.com wrote: Hi! Here's the demonstrating code:    # module foo.py    var = 0    def set():        global var        var = 1 Script using this module:    import foo    from foo import *    print var, foo.var    set()    

Re: Why do directly imported variables behave differently than those attached to imported module?

2011-05-03 Thread Chris Rebert
On Tue, May 3, 2011 at 2:47 PM, Chris Angelico ros...@gmail.com wrote: On Wed, May 4, 2011 at 2:57 AM, Chris Rebert c...@rebertia.com wrote: from foo import * can be thought of as essentially doing: import foo set = foo.set var = foo.var del foo Here's a side point. What types will hold

Re: codec for UTF-8 with BOM

2011-05-02 Thread Chris Rebert
On Mon, May 2, 2011 at 1:34 AM, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Hi! I want to write a file starting with the BOM and using UTF-8, and stumbled across some problems: 1. I would have expected one of the codecs to be 'UTF-8 with BOM' or something like that, but I can't

Re: (beginner question) ConfigParser nuances

2011-05-02 Thread Chris Rebert
On Mon, May 2, 2011 at 3:04 PM, Unknown Moss unknownm...@gmail.com wrote: Hi - Beginner question here. I'm working with ConfigParser. I'd like to take a multiline variable and convert it directly to an array. Seems like a common  problem, but I don't see how I can do it without doing a little

Re: complex data structures in python

2011-05-02 Thread Chris Rebert
On Mon, May 2, 2011 at 7:46 PM, Rita rmorgan...@gmail.com wrote: Hello, I was wondering if anyone has any documentation/recipes for implementing complex data structures. For instance, if you had a dictionary with a list inside a list inside a set. Er, there's no special magic. The datatypes

Re: What other languages use the same data model as Python?

2011-05-01 Thread Chris Rebert
On Sun, May 1, 2011 at 1:45 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Python uses a data model of name binding and call by object (also known as call by sharing). snip As I understand it, Python and Ruby have the same data model. So does Java, so long as you only consider

Re: PIL Question

2011-05-01 Thread Chris Rebert
On Sun, May 1, 2011 at 1:50 PM, PyNewbie ryan.morr...@gmail.com wrote: Hi, I'm new with Python and PIL. I have a very simple question regarding an image capture function I'm attempting. Here is the code: from PIL import ImageGrab ImageGrab.grab().save(screen_capture.jpg, JPEG)

Re: Need your help

2011-04-28 Thread Chris Rebert
On Wed, Apr 27, 2011 at 10:38 PM, 1011_wxy 1011_...@163.com wrote: Hi friends: Here I need some help. #encoding=utf-8 #moudle a.py def a():     print function a! #encoding=utf-8 #moudle b.py def b():     print function b! #encoding=utf-8 #moudle c.py import a import b def

Re: NaN

2011-04-28 Thread Chris Rebert
On Thu, Apr 28, 2011 at 9:21 AM, Eric Snow ericsnowcurren...@gmail.com wrote: There's a big discussion going on at python-dev and python-ideas about NaN (not-a-number, from IEEE 754).  I haven't really gotten into any scientific computing or numeric programming so I have never knowingly dealt

Re: use of index (beginner's question)

2011-04-27 Thread Chris Rebert
On Wed, Apr 27, 2011 at 6:23 PM, Thomas 'PointedEars' Lahn pointede...@web.de wrote: Chris Angelico wrote: Rusty Scalf wrote: list1 = ['pig', 'horse', 'moose'] list2 =  ['62327', '49123', '79115'] n = 2 s2 = list + `n` I would prefer the clearer  s2 = list + str(n) or  s2 = list%s %

Re: How to concatenate unicode strings ???

2011-04-26 Thread Chris Rebert
On Tue, Apr 26, 2011 at 8:58 AM, Ariel isaacr...@gmail.com wrote: Hi everybody, how could I concatenate unicode strings ??? What I want to do is this: unicode('this an example language ') + unicode('español') but I get an: Traceback (most recent call last):   File console, line 1, in

[issue11926] help(keywords) returns incomplete list of keywords

2011-04-25 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11926 ___ ___ Python-bugs-list

Re: Pls chk my login script

2011-04-24 Thread Chris Rebert
On Sun, Apr 24, 2011 at 3:05 PM, nusrath ahmed nusrathah...@yahoo.com wrote: I have written a python script for logging into a website. My script pulls up a browser page but does not log me in. Can any one suggest if I i am wrong in nay way,though the script is correct I am sure My script is

Re: detecting newline character

2011-04-23 Thread Chris Rebert
On Sat, Apr 23, 2011 at 11:09 AM, Daniel Geržo dan...@rulez.sk wrote: Hello guys, I need to detect the newline characters used in the file I am reading. For this purpose I am using the following code: def _read_lines(self):    with contextlib.closing(codecs.open(self.path, rU)) as fobj:    

Re: Input() in Python3

2011-04-22 Thread Chris Rebert
On Thu, Apr 21, 2011 at 11:22 PM, harrismh777 harrismh...@charter.net wrote: My interactive scripts are giving errors on the input(). I discovered another fairly significant change in Python3, as discussed in PEP 3111. I was a little flabbergasted to discover that input() was proposed to be

Re: PyLZMA lastwritetime file to python datetime

2011-04-22 Thread Chris Rebert
On Fri, Apr 22, 2011 at 1:49 AM, rabusta rabu...@gmail.com wrote: How convert lastwritetime file to python datetime? [Mildly educated guess after scanning https://github.com/fancycode/pylzma/blob/master/py7zlib.py ]: It's likely a Unix timestamp. Perhaps try datetime.datetime.utcfromtimestamp()

Re: suggestions, comments on an is_subdict test

2011-04-22 Thread Chris Rebert
On Fri, Apr 22, 2011 at 6:55 AM, Vlastimil Brom vlastimil.b...@gmail.com wrote: Hi all, I'd like to ask for comments or advice on a simple code for testing a subdict, i.e. check whether all items of a given dictionary are present in a reference dictionary. Sofar I have: def

Re: Writing Exif File

2011-04-20 Thread Chris Rebert
On Wed, Apr 20, 2011 at 12:00 AM, Jean-Pierre M pythonrubyl...@gmail.com wrote: I want to enter Comments of a picture in a JPeg file. Is there  a library in Python which allow me to do that without  having to reinvent the wheel? The target is to read those comments in my private webSite

Re: Vectors

2011-04-20 Thread Chris Rebert
On Wed, Apr 20, 2011 at 12:47 AM, Algis Kabaila akaba...@pcug.org.au wrote: Hi, Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication [scalar and vector]. Could you give me a reference to such module? Dunno if it has 3D-specific

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 4:44 AM, Mark Carter alt.mcar...@gmail.com wrote: I'm in python 2.6.5, and have Firefox 3.6.13. I would like to download some html from a site and scrape it programatically. The site requires a cookie, which I have in Firefox. Is there a simple python recipe I can use

Re: Looking for a urllib(2) cookie handler

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 5:48 AM, Mark Carter alt.mcar...@gmail.com wrote: On Apr 19, 12:44 pm, Mark Carter alt.mcar...@gmail.com wrote: url and say just use the cookie that I have in Firefox? mechanize looks kinda like what I want, but i still can't get it to work properly. So far I have:

Re: Pickling over a socket

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 11:53 AM, Roger Alexander rtalexan...@mac.com wrote: Hi, I'm trying to understand how to pickle Python objects over a TCP socket. In the example below (based on code from Foundations of Python Network Programming), a client creates a dictionary (lines 34-38) and uses

Re: My stupidity / strange inconsistency overriding class methods

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 4:52 PM, andrew cooke and...@acooke.org wrote: Hi, I've been staring at this problem, in various forms, all day.  Am I missing something obvious, or is there some strange hardwiring of isinstance?  This is with Python 3.2.        class A(metaclass=ABCMeta):        

Re: Remote Connection

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 6:04 PM, ray r...@aarden.us wrote: I wonder if there is a solution to provide remote connections between two computers similar to Remote Desktop.  The difference I am looking for is to be able to deliver speech/audio from the local machine to the remote machine which

Re: List comprehension vs filter()

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico ros...@gmail.com wrote: snip type=lst[0][type].lower() Tangent: Don't call it type; you're shadowing the built-in class of the same name. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: List comprehension vs filter()

2011-04-19 Thread Chris Rebert
On Tue, Apr 19, 2011 at 8:23 PM, Chris Angelico ros...@gmail.com wrote: On Wed, Apr 20, 2011 at 1:22 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Apr 19, 2011 at 8:10 PM, Chris Angelico ros...@gmail.com wrote: snip type=lst[0][type].lower() Tangent: Don't call it type; you're shadowing

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread Chris Rebert
On Mon, Apr 18, 2011 at 4:07 PM, goldtech goldt...@worldpost.com wrote: Hi, Trying to learn how to run a linux command and get the stdout and stderr. I'm trying the following: cmd3 = r'ffmpeg -i /home/giga/Desktop/Guitar1.flv' p = Popen(cmd3, stdout=PIPE, stderr=PIPE) Traceback (most

Re: Namespaces in functions vs classes

2011-04-17 Thread Chris Rebert
On Sun, Apr 17, 2011 at 12:30 PM, Gerald Britton gerald.brit...@gmail.com wrote: I apologize if this has been answered before or if it is easy to find in the docs. (I couldn't find it but might have missed it) I'm trying to understand the differences between namespaces in class definitions

Re: Equivalent code to the bool() built-in function

2011-04-17 Thread Chris Rebert
On Sun, Apr 17, 2011 at 9:53 PM, Chris Angelico ros...@gmail.com wrote: On Mon, Apr 18, 2011 at 2:40 PM, Ned Deily n...@acm.org wrote: snip Even better: $ python2.7 -c 'False = True; print False' True http://bofh.ch/bofh/bofh13.html Alas: $ python3 -c 'False = True; print(False)'  File

Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Chris Rebert
On Sat, Apr 16, 2011 at 1:24 PM, candide candide@free.invalid wrote: Consider the following code : # -- def bool_equivalent(x):    return True if x else False # testing ... def foo(x):    return 10*x class C:    pass for x in [42, (my,baby),

Re: Equivalent code to the bool() built-in function

2011-04-16 Thread Chris Rebert
On Sat, Apr 16, 2011 at 4:51 PM, candide candide@free.invalid wrote: Le 16/04/2011 23:38, Ben Finney a écrit : So the answer to the OP's question is no: the function isn't equivalent to the type, Can bool() type and bool_equivalent() function return different values ? No. The distinction

Re: PYTHONPATH

2011-04-15 Thread Chris Rebert
On Fri, Apr 15, 2011 at 1:33 AM, Algis Kabaila akaba...@pcug.org.au wrote: Hi, An elementary question that is bugging me, regarding sys.path values.sys.path can be altered easily, but the changes last for the current session only. I would like the changes to stay for several sessions.  Is

Re: pyc to py

2011-04-13 Thread Chris Rebert
On Wed, Apr 13, 2011 at 2:46 AM, luca72 lucabe...@libero.it wrote: I have pyc file written with python 2.6.5 and i need to return to py file, can you give me some ideas tools script etc. http://www.crazy-compilers.com/decompyle/ Cheers, Chris --

Re: Help with regex needed

2011-04-12 Thread Chris Rebert
On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk yuri.slobodyan...@gmail.com wrote: Good day everyone, I am trying to make this pretty simple regex to work but got stuck, I'd appreciate your help . Some people, when confronted with a problem, think 'I know, I'll use regular expressions.'

Re: download web pages that are updated by ajax

2011-04-12 Thread Chris Rebert
On Tue, Apr 12, 2011 at 7:47 AM, Jabba Laci jabba.l...@gmail.com wrote: Hi, I want to download a web page that is updated by AJAX. The page requires no human interaction, it is updated automatically: http://www.ncbi.nlm.nih.gov/nuccore/CP002059.1 If I download it with wget, I get a file of

Re: Feature suggestion -- return if true

2011-04-12 Thread Chris Rebert
On Tue, Apr 12, 2011 at 11:00 AM, Teemu Likonen tliko...@iki.fi wrote: * 2011-04-12T10:27:55+10:00 * James Mills wrote: On Tue, Apr 12, 2011 at 9:17 AM, zildjohn01 zildjoh...@gmail.com wrote: This is an idea I've had bouncing around in my head for a long time now. I propose the following

Re: [Feature Request] dict.setdefault()

2011-04-11 Thread Chris Rebert
On Mon, Apr 11, 2011 at 2:35 PM, rantingrick rantingr...@gmail.com wrote: setdefault should take **kw args in the case of needing to set multiple defaults at one time. I would even settle for an *arg list if i had to. What would the return value be? dict.setdefault() doesn't currently just

Re: Help with regex needed

2011-04-11 Thread Chris Rebert
On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk yuri.slobodyan...@gmail.com wrote: Good day everyone, I am trying to make this pretty simple regex to work but got stuck, I'd appreciate your help . Task: Get current date , then read file of format below, find the line that matches the

Re: Python 3.2 vs Java 1.6

2011-04-09 Thread Chris Rebert
On Fri, Apr 8, 2011 at 11:34 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: snip Have a look at the programming language shoot- out: http://shootout.alioth.debian.org/ Don't jump to conclusions: http://shootout.alioth.debian.org/dont-jump-to-conclusions.php [By the way,

Re: Confused about __prepare__

2011-04-07 Thread Chris Rebert
On Thu, Apr 7, 2011 at 3:31 PM, andrew cooke and...@acooke.org wrote: In the code below I use __prepare__ to change the class dictionary so that a tuple is stored in __setitem__().  Since __getitem__() removes the tuple I wasn't expecting any problems, but it seems that __init__ is being

Re: python 3 - instantiating class from user input

2011-04-06 Thread Chris Rebert
On Wed, Apr 6, 2011 at 9:04 PM, Brad Bailey computer_b...@yahoo.com wrote: I dont understand why this is such a big deal. Nor do i understand why google can't find a reasonable answer. If one can't figure out from the title what I'm trying to do, then a look at code should firmly plant the

Re: python 3 - instantiating class from user input

2011-04-06 Thread Chris Rebert
On Wed, Apr 6, 2011 at 9:41 PM, Chris Rebert c...@rebertia.com wrote: On Wed, Apr 6, 2011 at 9:04 PM, Brad Bailey computer_b...@yahoo.com wrote: I dont understand why this is such a big deal. Nor do i understand why google can't find a reasonable answer. If one can't figure out from

Re: Standard config file format

2011-04-05 Thread Chris Rebert
On Tue, Apr 5, 2011 at 7:16 PM, Vincent Davis vinc...@vincentdavis.net wrote: I am working on a program to monitor directory file changes and am would like a configuration file. This file would specify email addresses, file and directory locations.. Is there a preferred format to use with

Re: using python to post data to a form

2011-04-04 Thread Chris Rebert
On Sun, Apr 3, 2011 at 10:36 PM, Littlefield, Tyler ty...@tysdomain.com wrote: Hello: I have some data that needs to be fed through a html form to get validated and processed and the like. How can I use python to send data through that form, given a specific url? the form says it uses post,

Re: string to path problem

2011-04-03 Thread Chris Rebert
On Sun, Apr 3, 2011 at 8:30 PM, ecu_jon hayesjd...@yahoo.com wrote: i am writing a basic backup program for my school. so they wanted the possibility to be able to set source/destination from a config file. my source/destination was fine before, i would build it up with functions, like 1 that

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 8:07 PM, Gnarlodious gnarlodi...@gmail.com wrote: I'm running a shell command like: plutil -convert xml1 ~/Library/Preferences/iCab/iCab 4 Bookmarks Getting error: ~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied How would I capture this error using a

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 9:03 PM, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious gnarlodi...@gmail.com wrote: I get it, you instantiate an object, call a method and get a tuple in response. However, here is what I see: process.communicate()

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
Bookmarks: Permission denied\n', b'') So all I get is the string and no error message, /quote On Sat, Apr 2, 2011 at 9:00 PM, Gnarlodious gnarlodi...@gmail.com wrote: On Apr 2, 9:29 pm, Chris Rebert wrote: if proc.returncode: # non-zero exit status, indicating error     print(Encountered error

Re: newbie question

2011-04-01 Thread Chris Rebert
On Fri, Apr 1, 2011 at 12:52 PM, Karl 8213543ggxnvjx...@kabelmail.de wrote: Hello, one beginner question: aList = [0, 1, 2, 3, 4] bList = [2*i for i in aList] Equivalently: bList = [0, 2, 4, 6, 8] sum = 0 for j in bList: Note that you're iterating over *b*List here, as opposed to

Re: Extracting true words

2011-04-01 Thread Chris Rebert
On Fri, Apr 1, 2011 at 1:55 PM, candide candide@free.invalid wrote: Back again with my study of regular expressions ;) There exists a special character allowing alphanumeric extraction, the special character \w (BTW, what the letter 'w' refers to?). Word presumably/intuitively; hence the

Re: Directly Executable Files in Python

2011-03-28 Thread Chris Rebert
On Mon, Mar 28, 2011 at 8:37 PM, Jordan Meyer jordanmeyer1...@gmail.com wrote: Is it possible to make a directly executable (such as .exe on Windows) file from scripts written in Python? So as to prevent the end-user from having to download an interpreter to run the program. Yes. py2exe is a

Re: dynamic assigments

2011-03-24 Thread Chris Rebert
On Thu, Mar 24, 2011 at 1:39 PM, Seldon sel...@katamail.it wrote: Hi, I have a question about generating variable assignments dynamically. This can frequently be a code smell. I have a list of 2-tuples like this ( (var1, value1), (var2, value2), .. , ) where var1, var2, ecc. are

Re: how to install the PLY (Python Lex-Yacc) package in windows

2011-03-22 Thread Chris Rebert
On Mon, Mar 21, 2011 at 10:53 PM, Sachin Kumar Sharma ssharm...@slb.com wrote: BB, I downloaded PLY (Python Lex-Yacc) package for a script use it for parsing and looking to install under windows. It has setup.py file, and the command mentioned for installation is Python setup.py install

Re: Proxy authentication required

2011-03-22 Thread Chris Rebert
On Tue, Mar 22, 2011 at 3:57 AM, gervaz ger...@gmail.com wrote: On 22 Mar, 09:34, gervaz ger...@gmail.com wrote: On 22 Mar, 00:02, Chris Rebert c...@rebertia.com wrote: On Mon, Mar 21, 2011 at 2:38 AM, gervaz ger...@gmail.com wrote: Hi all, I've got to download some web pages but I'm

Re: Proxy authentication required

2011-03-21 Thread Chris Rebert
On Mon, Mar 21, 2011 at 2:38 AM, gervaz ger...@gmail.com wrote: Hi all, I've got to download some web pages but I'm behind a proxy. So far this is what I've used without any successful result receiving the error: urllib.error.HTTPError: HTTP Error 407: Proxy Authentication Required ( The ISA

Re: creating RAW sockets

2011-03-17 Thread Chris Rebert
On Wed, Mar 16, 2011 at 10:36 PM, moijes12 moije...@gmail.com wrote: Hi I am unable to create RAW sockets using python. Traceback (most recent call last):  File getsockopt_handler.py, line 6, in ?    send = socket(AF_INET,SOCK_RAW,IPPROTO_IP) socket.error: (94, 'Socket type not supported')

Re: PDF To Postscript

2011-03-17 Thread Chris Rebert
On Thu, Mar 17, 2011 at 6:55 AM, Adam Tauno Williams awill...@whitemice.org wrote: PyPDF (and others) provide a very nice mechanism for creating and manipulating PDF documents.  Is there any *Python* module or technique to turn a PDF document into Postscript [to print, for example]?

Re: newbie question (for loop)

2011-03-15 Thread Chris Rebert
On Tue, Mar 15, 2011 at 1:01 AM, Sachin Kumar Sharma ssharm...@slb.com wrote: I am getting error on the following syntax while running in Ipython and spyder and I failed to figure out why for  i  in  range(len(list))      ^ SyntaxError: invalid syntax You

Re: alphanumeric list

2011-03-15 Thread Chris Rebert
On Tue, Mar 15, 2011 at 1:10 AM, yqyq22 yqy...@hotmail.com wrote: Hi all, I would like to put an alphanumeric string like this one EE472A86441AF2E629DE360 in a list, then iterate inside the entire string lenght and change each digit with a random digit. Do u have some suggestion? thanks a lot

Re: using simplejson.dumps to encode a dictionary to json

2011-03-15 Thread Chris Rebert
On Tue, Mar 15, 2011 at 12:56 PM, Aaron aaron.jerl...@gmail.com wrote: If I print authreq_data to screen  I get {req: {username: ##, password: #, productType: CFD_Demo}} Essentially I want the inner brackets to be  [ ] instead of {} but alternating on each level so it would be:

Re: Compile time evaluation of dictionaries

2011-03-10 Thread Chris Rebert
On Thu, Mar 10, 2011 at 4:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 10 Mar 2011 17:40:40 -0500, Terry Reedy wrote: On 3/10/2011 11:23 AM, Gerald Britton wrote: Today I noticed that an expression like this: one:%(one)s two:%(two)s % {one: is the loneliest

Re: Finding keywords

2011-03-08 Thread Chris Rebert
On Mon, Mar 7, 2011 at 11:18 PM, Cross x...@x.tv wrote: Hello I have got a project in which I have to extract keywords given a URL. I would like to know methods for extraction of keywords. Frequency of occurence is one; but it seems naive. I would prefer something more robust. Please

Re: SCM

2011-03-08 Thread Chris Rebert
On Tue, Mar 8, 2011 at 3:42 AM, Cliff Scherer cliffsche...@me.com wrote: Hi, I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Any idea ? Some googling turned up https://sites.google.com/a/logopt.com/www/ If you're doing simulations,

Re: Extending dict (dict's) to allow for multidimensional dictionary

2011-03-07 Thread Chris Rebert
On Sun, Mar 6, 2011 at 11:06 PM, Javier nos...@nospam.com wrote: Looks a good idea.  I use this kind of recursive dicts to represent tree like datastruct in python.  Like: car[ford][taurus][price]=... car[toyota][corolla][mpg]=... car[toyota][corolla][price]=... snip Does anybody have  

Re: Numerical representation

2011-03-07 Thread Chris Rebert
On Fri, Mar 4, 2011 at 2:32 PM, Jon Herman jfc.her...@gmail.com wrote: I am new to the Python language and writing a Runge-Kutta-Fellberg 7(8) integrator in Python, which requires an extreme numerical precision for my particular application. Unfortunately, I can not seem to attain it. The

Re: how to communicate in python with an external process

2011-03-07 Thread Chris Rebert
On Mon, Mar 7, 2011 at 1:58 PM, Danny Shevitz shev...@lanl.gov wrote: Howdy, I'm a long time python user but ran across something I have never needed to do before and don't know how to do it. The issue is that I need for my python script to call some matlab routines. Matlab is very

Re: Playing WAV file with Python

2011-03-03 Thread Chris Rebert
On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux vgnuli...@gmail.com wrote: Hi All, How can I play WAV file in python without OS(like Linux/Windows/MAC) on a device ? On Google I found lot of different solution but related to OS's like winsound, ossaudiodev etc which are not useful. Do you mean

Re: Python escape usage in django templates by GAE

2011-03-03 Thread Chris Rebert
On Wed, Mar 2, 2011 at 11:50 PM, Niklasro nikla...@gmail.com wrote: Hi I got problems with escape displaying like junk when upgrading from django 0.96 to 1.2 with google app engine. The code is     # let user choose authenticator        for p in openIdProviders:            p_name =

Re: Playing WAV file with Python

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 12:17 AM, VGNU Linux vgnuli...@gmail.com wrote: On Thu, Mar 3, 2011 at 1:26 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Mar 1, 2011 at 11:47 PM, VGNU Linux vgnuli...@gmail.com wrote: How can I play WAV file in python without OS(like Linux/Windows/MAC

Re: subprocess running ant

2011-03-03 Thread Chris Rebert
From: MRAB On 03/03/2011 18:14, Thom Hehl wrote: I am attempting to write a python script that will check out and build our code, then deploy the executable. It will report any failures via e-mail. To this end, I'm trying to run my ant build from inside of python. I have tried the

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net wrote: Does python have an analogy to c/perl incrementer? e.g. i = 0 i++ i += 1 If you're doing this for a list index, use enumerate() instead. Regards, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: auto increment

2011-03-03 Thread Chris Rebert
On Thu, Mar 3, 2011 at 9:05 PM, Dan Stromberg drsali...@gmail.com wrote: On Thu, Mar 3, 2011 at 8:48 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Mar 3, 2011 at 8:41 PM, monkeys paw mon...@joemoney.net wrote: Does python have an analogy to c/perl incrementer? e.g. i = 0 i++ i

Re: urlopen returns forbidden

2011-02-28 Thread Chris Rebert
On Mon, Feb 28, 2011 at 9:44 AM, Terry Reedy tjre...@udel.edu wrote: On 2/28/2011 10:21 AM, Grant Edwards wrote: As somebody else has already said, if the site provides an API that they want you to use you should do so rather than hammering their web server with a screen-scraper. If there

Re: urlopen returns forbidden

2011-02-27 Thread Chris Rebert
On Sun, Feb 27, 2011 at 9:38 PM, monkeys paw mon...@joemoney.net wrote: I have a working urlopen routine which opens a url, parses it for a tags and prints out the links in the page. On some sites, wikipedia for instance, i get a HTTP error 403, forbidden. What is the difference in

Re: Removing hidden directory in os.walk()

2011-02-25 Thread Chris Rebert
On Fri, Feb 25, 2011 at 9:40 AM, Gaëtan Podevijn gpode...@gmail.com wrote: Hello, I would like that os.walk() does not walk through hidden directories. I know that with topdow = true, I can modify the subdirectory list in place, but how should I remove every hidden directory from this place in

Re: Connect to FTP

2011-02-25 Thread Chris Rebert
On Fri, Feb 25, 2011 at 6:37 AM, sofia stouki sofsto...@yahoo.com wrote: Hi all, I am trying to put together a script (Python 2.5, windows xp) that connects to an ftp server and retrieves/uploads files. I am sure what I have put together is completely insufficient and I get the errors:

Re: py3k: datetime resolution / isoformat

2011-02-25 Thread Chris Rebert
On Fri, Feb 25, 2011 at 6:21 PM, s...@uce.gov wrote: When I do:    datetime.datetime.now().isoformat(' ') I get the time with the microseconds. The docs says: if microsecond is 0 -MM-DDTHH:MM:SS+HH:MM. How do I set microsecond to 0?     datetime.datetime.microsecond = 0    

Re: What is the preferred way to sort/compare custom objects?

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:27 AM, Jeremy jlcon...@gmail.com wrote: I just discovered the wiki page on sorting (http://wiki.python.org/moin/HowTo/Sorting/).  This describes the new way of sorting a container instead of using the cmp function.  But what do I do for custom objects?  If I write

Re: Preferred method of sorting/comparing custom objects

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:41 AM, Jeremy jlcon...@gmail.com wrote: I recently found the wiki page on sorting (http://wiki.python.org/moin/HowTo/Sorting/).  This page describes the new key parameter to the sort and sorted functions. What about custom objects?  Can I just write __lt__, __gt__,

Re: n00b formatting

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:41 AM, Verde Denim tdl...@gmail.com wrote: hi, all i can't believe i don't see this, but python from the command line: x = '0D' y = '0x' + x print %d % int(y,0) 13 content of testme.py: Is this the *entire* contents of the file? I suspect not, and that somewhere

Re: Is setdefaultencoding bad?

2011-02-23 Thread Chris Rebert
On Wed, Feb 23, 2011 at 3:07 AM, moerchendiser2k3 googler.1.webmas...@spamgourmet.com wrote: Ok, but that the interface handles UTF-8 strings are still ok? The defaultencoding is still ascii. Yes, that's fine. UTF-8 is an excellent encoding choice, and encoding/decoding should always be done

Re: pattern matching

2011-02-23 Thread Chris Rebert
On Wed, Feb 23, 2011 at 6:37 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 23 Feb 2011 21:11:53 -0500, monkeys paw wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat

Re: Accelerating For Loop

2011-02-22 Thread Chris Rebert
2011/2/22 Şansal Birbaş sansal.bir...@alarko-carrier.com.tr: Hi All, I needed to find the cheapest combination among given data and I developed an algorithm for this task. It works correctly. But it takes much time (nearly 2 minutes) for second function to find the result while it is just

Re: Python on OSX

2011-02-21 Thread Chris Rebert
On Mon, Feb 21, 2011 at 3:54 PM, Robert sigz...@gmail.com wrote: Can I install 2.7 and 3.2 side by side? Yes, of course. Just don't fiddle with the System Python (i.e. the copy preinstalled by Apple). You may wish to install your additional Pythons via Fink or MacPorts. Cheers, Chris --

Re: Python leaks in cyclic garbage collection

2011-02-18 Thread Chris Rebert
On Fri, Feb 18, 2011 at 8:10 PM, moerchendiser2k3 googler.1.webmas...@spamgourmet.com wrote: Hi, I have some problems with Python and the garbage collection. In the following piece of code I create a simple gargabe collection but I am still wondering why the finalizers are never called - at

Re: file/folder naming

2011-02-18 Thread Chris Rebert
On Fri, Feb 18, 2011 at 8:29 PM, ecu_jon hayesjd...@yahoo.com wrote: im trying to use wxpython to get a source file/files, then a destination folder to write them to. the file and folder picker works. the problem is, actually copying (actually shutil.copy2() ). i get an except error Please

Re: file/folder naming

2011-02-18 Thread Chris Rebert
On Fri, Feb 18, 2011 at 10:13 PM, ecu_jon hayesjd...@yahoo.com wrote: ok changed the try/except to just a file copy and got this: sourcepath is : [u'I:\\college\\spring11\\capstone-project\ \facbac-009.py'] destpath is : V:\week3 destpath is : V:\week3\facbac-009.py Traceback (most recent

<    3   4   5   6   7   8   9   10   11   12   >