Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
On 26.04.2010 22:26, * Dodo: Le 26/04/2010 22:26, Alf P. Steinbach a écrit : On 26.04.2010 22:12, * Dodo: Hi all, Under python 2.6, chr() "Return a string of one character whose ASCII code is the integer i." (quoted from docs.python.org) Under python 3.1, chr() "Return th

Re: chr(i) ASCII under Python 3

2010-04-26 Thread Alf P. Steinbach
On 26.04.2010 22:12, * Dodo: Hi all, Under python 2.6, chr() "Return a string of one character whose ASCII code is the integer i." (quoted from docs.python.org) Under python 3.1, chr() "Return the string of one character whose Unicode codepoint is the integer i." I want to convert a ASCII code b

Re: [ANN] pyjamas 0.7 released

2010-04-25 Thread Alf P. Steinbach
* Luke Kenneth Casson Leighton: http://pyjs.org/examples/asteroids/public/Space.html An error has been encountered in accessing this page. 1. Server: pyjs.org 2. URL path: /examples/asteroids/public/examples/asteroids/public/bootstrap.js 3. Error notes: NONE 4. Error type: 404 5. Reques

Re: when should I explicitly close a file?

2010-04-24 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 23 Apr 2010 13:19:41 +0200, Alf P. Steinbach wrote: But for a literal context-free interpretation e.g. the 'sys.getrefcount' function is not documented as CPython only and thus an implementation that didn't do reference counting would not be

Re: when should I explicitly close a file?

2010-04-23 Thread Alf P. Steinbach
* Adam Tauno Williams: On Fri, 2010-04-23 at 16:29 +1200, Lawrence D'Oliveiro wrote: In message , Chris Rebert wrote: On Wed, Apr 21, 2010 at 5:53 PM, Lawrence D'Oliveiro wrote: In message <4bc9aad...@dnews.tpgi.com.au>, Lie Ryan wrote: Since in python nothing is guaranteed about implicit fil

Re: Linux servers, network and file names

2010-04-23 Thread Martin P. Hellwig
On 04/22/10 15:13, Infinity77 wrote: For me: //SERVER/gavana/Folder/FileName.txt Colleague: //SERVER/Colleague/Folder/FileName.txt So, no matter what I do, the file name stored in the database is user- dependent and not universal and common to all of us. If that user dependent part happens t

Re: string caracters:

2010-04-22 Thread Alf P. Steinbach
* luca72: i get a string from a web server and i save it in to a file, that i open the file and i read the string: the string looks like : http://lhti.gs/JKBTYD after the read i use webbrowser open (sting), but i get the error because at the end of the string are added '%0D%0A', and if i ask for

Re: a.extend(b) better than a+=b ?

2010-04-22 Thread Alf P. Steinbach
* candide: Suppose a and b are lists. What is more efficient in order to extend the list a by appending all the items in the list b ? I imagine a.extend(b)to be more efficient for only appendinding the items from b while a+=b creates a copy of a before appending, right ? No. But in gener

Re: when should I explicitly close a file?

2010-04-21 Thread Alf P. Steinbach
* Lawrence D'Oliveiro: In message <4bc9aad...@dnews.tpgi.com.au>, Lie Ryan wrote: Since in python nothing is guaranteed about implicit file close ... It is guaranteed that objects with a reference count of zero will be disposed. Only in current CPython. In my experiments, this happens i

Re: rfind bug ?

2010-04-21 Thread Alf P. Steinbach
* Chris Rebert: On Wed, Apr 21, 2010 at 2:59 AM, Stef Mientki wrote: On 21-04-2010 10:56, Chris Rebert wrote: On Wed, Apr 21, 2010 at 1:51 AM, Stef Mientki wrote: With the following code, I would expect a result of 5 !! a= 'word1 word2 word3' a.rfind(' ',7) 11 Is this a bug ? No. Don'

Re: Building a GUI Toolkit

2010-04-20 Thread Martin P. Hellwig
On 04/20/10 21:15, Martin P. Hellwig wrote: On 04/20/10 19:53, Lie Ryan wrote: Rather than writing a windowing toolkit from the low-level, I would rather like to see some wrapper for existing windowing toolkit which uses more pythonic idioms. Most popular python GUI toolkit currently in use

Re: Building a GUI Toolkit

2010-04-20 Thread Martin P. Hellwig
On 04/20/10 19:53, Lie Ryan wrote: Rather than writing a windowing toolkit from the low-level, I would rather like to see some wrapper for existing windowing toolkit which uses more pythonic idioms. Most popular python GUI toolkit currently in use are only a simple thin wrapper over the librar

Req. for feedback -- writings on error handling & cleanup (Py3)

2010-04-19 Thread Alf P. Steinbach
After at least 3 false starts on my programming introduction's chapter 3, and some good and bad feedback from this group[1], I finally think the present chapter 3 approach is Good (enough). So no, I haven't given up in this book project, even though 4 months to produce these chapter 3's first

Re: Building a GUI Toolkit

2010-04-18 Thread Martin P. Hellwig
On 04/18/10 12:49, Tim Diels wrote: Hi I was thinking of writing a GUI toolkit from scratch using a basic '2D library'. I have already come across the Widget Construction Kit. My main question is: Could I build a GUI toolkit of reasonable performance with the Widget Construction Kit, would it s

Re: Incorrect scope of list comprehension variables

2010-04-16 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 16 Apr 2010 08:48:03 -0700, Aahz wrote: In article <4bb92850$0$8827$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: Nevertheless, it is a common intuition that the list comp variable should *not* be exposed outside of the list comp, and that the for-loop variable

Re: Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
* Alf P. Steinbach: Found a another bug discussion with * same exception, 0xc417 STATUS_INVALID_CRUNTIME_PARAMETER * same address, 0x78588389 * almost same Python version, namely Py3, * almost same context, namely occurring when program terminates, at http

Re: Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
* Alf P. Steinbach: * Alf P. Steinbach: > [About baffling almost not reproducible interpreter crash on Ctrl C] The error code 0xc417 is some custom one, not a standard Windows code. Sorry, I was wrong about that, just that the MS ErrLook utility didn't find it

Re: Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
* Alf P. Steinbach: > [About baffling almost not reproducible interpreter crash on Ctrl C] The error code 0xc417 is some custom one, not a standard Windows code. Sorry, I was wrong about that, just that the MS ErrLook utility didn't find it. http://social.msdn.microsoft.com/F

Re: Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
* Alf P. Steinbach: * MRAB: Alf P. Steinbach wrote: Python 3.1.1 in Windows XP Prof: def number_from_user( prompt ): while True: spec = input( prompt ) try: return float( spec ) except ValueError: s = "Sorry, '{}' is not

Re: Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
* MRAB: Alf P. Steinbach wrote: Python 3.1.1 in Windows XP Prof: def number_from_user( prompt ): while True: spec = input( prompt ) try: return float( spec ) except ValueError: s = "Sorry, '{}' is not a valid number spec.

Can anyone reproduce this crash?

2010-04-16 Thread Alf P. Steinbach
Python 3.1.1 in Windows XP Prof: def number_from_user( prompt ): while True: spec = input( prompt ) try: return float( spec ) except ValueError: s = "Sorry, '{}' is not a valid number spec. Try e.g. '3.14'." print( s.format( spec )

Re: msvcr90.dll is MIA?

2010-04-14 Thread Alf P. Steinbach
* Alex Hall: Hi all, For testing purposes, and because I am not yet distributing my application (which, thanks to you all, is now running perfectly!), I am going to just bundle msvcr90.dll. However, I cannot find it! I ran vcredist_x86.exe (I have a 64-bit version of win7, but all I have is the x

Re: Unit testing errors (testing the platform module)

2010-04-13 Thread Martin P. Hellwig
On 04/13/10 15:01, John Maclean wrote: I normally use languages unit testing framework to get a better understanding of how a language works. Right now I want to grok the platform module; 1 #!/usr/bin/env python 2 '''a pythonic factor''' 3 import unittest 4 import platform 5 6

Re: curious about python version numbers

2010-04-13 Thread Alf P. Steinbach
* Alex Hall: Hi all, I am just curious: if Python3.x is already out, why is 2.7 being released? Are there two main types of Python? Thanks. Old code and old programming habits may work as-is with 2.7 but not with a 3.x implementation. So yes, there are two main extant variants of Python, 2.x

Re: 2.7 beta 1

2010-04-11 Thread Martin P. Hellwig
On 04/12/10 06:57, Mensanator wrote: On Apr 11, 6:08 pm, Steven D'Aprano wrote: On Sun, 11 Apr 2010 11:54:04 -0700, Mensanator wrote: On Apr 11, 11:53 am, Steven D'Aprano wrote: On Sat, 10 Apr 2010 21:08:44 -0700, Mensanator wrote: Maybe because I'm a user, not a developer. You write co

Re: Cleanup guarantees?

2010-04-10 Thread Alf P. Steinbach
* Gabriel Genellina: En Fri, 09 Apr 2010 01:13:37 -0300, Alf P. Steinbach escribió: > > import urllib.request # urlopen > import codecs # getreader > import sys # stderr > > def text_stream_from( url, encoding ): > text_reader = codec

Re: The Regex Story

2010-04-09 Thread Alf P. Steinbach
language unrelated to normal maths syntax for doing so: # Calculate the roots of sin**2(3*x-y): result = me.compile("{^g.?+*y:h}|\Y^r&(?P:2+)|\w+(x&y)|[?#\s]").solve() http://www.youtube.com/watch?v=a9xAKttWgP4 Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: Cleanup guarantees?

2010-04-08 Thread Martin P. Hellwig
On 04/09/10 05:13, Alf P. Steinbach wrote: Second, I'm unable to find documentation of when they're called and what they do. It seems that (A) when the connection object's stream is exhausted by reading, its close() method is called automatically, and (B) that when the text_

Cleanup guarantees?

2010-04-08 Thread Alf P. Steinbach
Consider ... import urllib.request # urlopen import codecs # getreader import sys # stderr def text_stream_from( url, encoding ): text_reader = codecs.getreader( encoding ) connection = urllib.request.urlopen( url ) return text_reader( connection ) def lis

Re: order that destructors get called?

2010-04-08 Thread Alf P. Steinbach
* Brendan Miller: Thanks Steven and Gabriel. Those are very informative responses. In my case my resource isn't bound to a lexical scope, but the: def __del__(self, delete_my_resource=delete_my_resource): pattern works quite well. I've made sure to prevent my class from being

Re: Q about assignment and references

2010-04-06 Thread Alf P. Steinbach
* jdbosmaus: Pretty new to Python, but I thought I understood what is meant by "an assignment is a reference." Until I tried to understand this. Here is a (fragment of an) event handler for a group of three wxPython toggle buttons. The idea is to change the appearance of the label of the button

Re: In disGuiodoise?

2010-04-05 Thread Martin P. Hellwig
On 04/05/10 00:05, r wrote: However i have also considered that maybe *all* the "well knowns" are in fact the many colorful personalities of Guido. De vraag is dan natuurlijk of al zijn persoonlijkheden nog steeds nederlands machtig zijn. -- mph -- http://mail.python.org/mailman/listinfo/

Re: local variable referenced before assignment

2010-04-04 Thread Alf P. Steinbach
* Stephen Hansen: On 2010-04-04 15:22:48 -0700, Alf P. Steinbach said: * johngilbrough: I cannot make sense of what's happening here ... I'm getting the following error: (1) At least in Py3 you can declare the variable as 'global', like this: global lastModi

Re: local variable referenced before assignment

2010-04-04 Thread Alf P. Steinbach
* johngilbrough: I cannot make sense of what's happening here ... I'm getting the following error: initializing last modified time /home/john/Dropbox/Projects/python/scripts/src 29 referencing last modified time /home/john/Dropbox/Projects/python/scripts/src 29 referencing last modified time Tr

Re: In disGuiodoise?

2010-04-04 Thread Alf P. Steinbach
* Patrick Maupin: On Apr 4, 11:14 am, "Alf P. Steinbach" wrote: "He walks among you, and you don't recognize him" - Old jungle proverb Hm, interesting Google results for that phrase. Interesting self-promotion :-) No, I'm not Guido. Cheers, - Alf --

In disGuiodoise?

2010-04-04 Thread Alf P. Steinbach
* ratingrick: A while back i had wondered why Guido never posts to c.l.py anymore. Was it because he thinks himself better than us, no, it's because of the "low-brow-infantile-Jerry-Springer-ish-nature" that this list has imploded into. Perhaps Guido provides subtle guidance under some unreco

Re: Incorrect scope of list comprehension variables

2010-04-04 Thread Alf P. Steinbach
* Ethan Furman: Steve Howell wrote: On Apr 3, 9:58 pm, Tim Roberts wrote: Alain Ketterlin wrote: I've just spent a few hours debugging code similar to this: d = dict() for r in [1,2,3]: d[r] = [r for r in [4,5,6]] print d Yes, this has been fixed in later revisions, but I'm curious

Re: Is there a standard name for this tree structure?

2010-04-04 Thread Alf P. Steinbach
* Steven D'Aprano: I have a hierarchical structure something like a directory tree or a nested tree structure: Mammal +-- Ape : +-- Chimpanzee : +-- Gorilla : +-- Human +-- Carnivore : +-- Cat : +-- Tiger Reptile +-- Lizard +-- Snake +-- Cobra +-- Python This is a forest

Re: Splitting a string

2010-04-03 Thread Alf P. Steinbach
* Steven D'Aprano: Tests which you know can't fail are called assertions, pre-conditions and post-conditions. We test them because if we don't, they will fail :) :-) It's the umbrella law. Cheers, - Alf -- http://mail.python.org/mailman/listinfo/python-list

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 16:46, Patrick Maupin wrote: On Apr 3, 9:43 am, "Martin P. Hellwig"> IMHO, the crackpot in this regard is actually partially right, multiplication does mean that the number must get bigger, however for fractions you multiply four numbers, two numerators and two deno

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 16:17, Steven D'Aprano wrote: On Sat, 03 Apr 2010 15:43:41 +0100, Martin P. Hellwig wrote: I am replying to this post not because I disagree but because it postalogically fits the best (I am by no means an expert either). IMHO, the crackpot in this regard is actually part

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 14:38, Steve Holden wrote: If you think you will persuade a crackpot to drop his lunacy by logical argument you are clearly an optimist of the first water. But since I like a challenge (and bearing in mind this is OT so I don't claim to be an expert) you might try first of all persu

Re: subclass of object

2010-04-02 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Jason Friedman: Hi, what is the difference between: def MyClass(object): pass and def MyClass(): pass If you really meant 'def', then the first is a routine taking one argument, and the second is a routine of no arguments. If

Re: subclass of object

2010-04-02 Thread Alf P. Steinbach
* Jason Friedman: Hi, what is the difference between: def MyClass(object): pass and def MyClass(): pass If you really meant 'def', then the first is a routine taking one argument, and the second is a routine of no arguments. If you meant 'class' instead of 'def', then it depends o

idle 2.x and unicode literals

2010-04-02 Thread Joe P. Cool
Hi, I'm working with Python 2.6.4 on Ubuntu 9.10 and noticed a difference between IDLE and command line python. If I enter an é (accented e, LATIN SMALL LETTER E WITH ACUTE) as a unicode string in command line python I get this: >>> u'é' u'\xe9' In IDLE 2.6.4 I get this: >>> u'é' u'\xc3\xa9'

Re: C-style static variables in Python?

2010-04-01 Thread Alf P. Steinbach
* kj: When coding C I have often found static local variables useful for doing once-only run-time initializations. For example: int foo(int x, int y, int z) { static int first_time = TRUE; static Mongo *mongo; if (first_time) { mongo = heavy_lifting_at_runtime(); first_time = FAL

Re: Get Eclipse/PyDev to run scripts that don't end in .py

2010-03-31 Thread Martin P. Hellwig
On 03/31/10 22:37, J wrote: Is there any way to tell PyDev in Eclipse to run a script that doesn't end in .py? Even if I have to go and manually set something for each file... I've inherited (in a manner of speaking) a dev project that is done in python2.6... I pulled the latest dev branch and

Re: Getting a Python program to run of off a flash drive?

2010-03-31 Thread Alf P. Steinbach
* Abethebabe: I wanted to know if there was a way I could get a Python program to run off of my flash drive as soon as the computer (Windows) detected the device? For example I could have a a simple program that would create a text document on the computers desktop when my flash drive is detecte

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Russ P.
On Mar 30, 10:08 am, John Nagle wrote: > Chris Rebert wrote: > > On Tue, Mar 30, 2010 at 8:40 AM, gentlestone wrote: > >> Hi, how can I write the popular C/JAVA syntax in Python? > > >> Java example: > >>    return (a==b) ? 'Yes' : 'No' > > >> My first idea is: > >>    return ('No','Yes')[bool(a=

Re: sort array, apply rearrangement to second

2010-03-30 Thread Alf P. Steinbach
* Victor Eijkhout: I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those keys. Obviously I could turn them into a dictionary of pairs and sort by the first member, but I think that's not very efficient, at leas

Re: "Usability, the Soul of Python"

2010-03-30 Thread Russ P.
; printf("Send one to abuse and Just Hit Delete,\n"); printf("%d slabs of spam in my mail!\n\n", i + 1); } On Mar 30, 4:40 am, "Alf P. Steinbach" wrote: > * Jean-Michel Pichavant: > > > John Nagle wrote: > >> Jonathan Hayward wrot

Re: "Usability, the Soul of Python"

2010-03-30 Thread Alf P. Steinbach
* Jean-Michel Pichavant: John Nagle wrote: Jonathan Hayward wrote: I've posted "Usability, the Soul of Python: An Introduction to the Python Programming Language Through the Eyes of Usability", at: http://JonathansCorner.com/python/ No, it's just a rather verbose introduction to Python

Re: sum for sequences?

2010-03-29 Thread Alf P. Steinbach
* Steven D'Aprano: On Sun, 28 Mar 2010 18:56:26 +0200, Alf P. Steinbach wrote: From a more practical point of view, the sum efficiency could be improved by doing the first addition using '+' and the rest using '+=', without changing the behavior. But that would

Re: sum for sequences?

2010-03-28 Thread Alf P. Steinbach
* Steve Howell: On Mar 28, 8:17 am, Duncan Booth wrote: Steve Howell wrote: The mildly surprising part of sum() is that is does add vs. add-in- place, which leads to O(N) vs. O(1) for the inner loop calls, for certain data structures, notably lists, even though none of the intermediate result

Re: Traversing through Dir()

2010-03-26 Thread Alf P. Steinbach
* Andrej Mitrovic: I would like to traverse through the entire structure of dir(), and write it to a file. Now, if I try to write the contents of dir() to a file (via pickle), I only get the top layer. So even if there are lists within the returned list from dir(), they get written as a list of

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/26/10 01:10, Rhodri James wrote: Pretty much. In the sense that you're thinking of, every assignment works that way, even the initial "TEST1 = One()". Assignment binds names to objects, though you have to be aware that names can be such exotic things as "t", "a[15]" or "TEST2.__instance_o

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/25/10 23:41, Christian Heimes wrote: Martin P. Hellwig schrieb: What I don't understand why in the second test, the last boolean is True instead of (what I expect) False. Could somebody enlighten me please as this has bitten me before and I am confused by this behavior. Hint: TEST

Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
Hi all, When I run the following snippet (drastically simplified, to just show what I mean): >> import platform, sys class One(object): def __init__(self): self.one = True def change(self): self.one = False class Two(object): def __init__(self): self._inst

Re: sum for sequences?

2010-03-25 Thread Alf P. Steinbach
* Neil Cerutti: On 2010-03-25, Steven D'Aprano wrote: You might not want to be so glib. The sum doc sure doesn't sound like it should work on lists. Returns the sum of a sequence of numbers (NOT strings) plus the value of parameter 'start' (which defaults to 0). What part of that sugg

Re: exiting threaded program?

2010-03-24 Thread Alf P. Steinbach
* Alex Hall: Hi all, I have a program with a timer in it, therefore I have multiple threads. Is the "therefore..." an inference or independendent information? If it is an inference then it may not be correct. For example, timers in a GUI program need not involve additional threads. My meth

Re: Pythonic way to trim and keep leading and trailing whitespace

2010-03-23 Thread Martin P. Hellwig
On 03/23/10 23:38, Tim Chase wrote: Just in case you're okay with a regexp solution, you can use >>> s = "\t\tabc def " >>> import re >>> r = re.compile(r'^(\s*)(.*?)(\s*)$') >>> m = re.match(s) >>> m.groups() ('\t\t', 'abc def', ' ') >>> leading, text, trailing = m.groups() Ahhh regex,

Some silly code for Easter holiday

2010-03-23 Thread Alf P. Steinbach
of like an Easter holiday mystery. # Py3 # Copyright 2010 Alf P. Steinbach import tkinter as tk from collections import namedtuple import random Point = namedtuple( "Point", "x, y" ) Size= namedtuple( "Size", "x, y" ) RGB

Re: How to automate accessor definition?

2010-03-22 Thread Alf P. Steinbach
* kj: In Dennis Lee Bieber writes: On Sun, 21 Mar 2010 16:57:40 + (UTC), kj declaimed the following in gmane.comp.python.general: Regarding properties, is there a built-in way to memoize them? For example, suppose that the value of a property is obtained by parsing the contents of a

Re: chroot fails with mount point passed to subprocess.Popen?

2010-03-22 Thread Alf P. Steinbach
* newton10471: Hi, I'm trying to use subprocess.Popen() to do a Linux chroot to a mount point passed in as a parameter to the following function: def getInstalledKernelVersion(mountPoint): linuxFsRoot = mountPoint + "/root" print "type of linuxFsRoot is %s" % type(linuxFsRoot) insta

Re: nonuniform sampling with replacement

2010-03-21 Thread Alf P. Steinbach
* Alf P. Steinbach: * Jah_Alarm: I've got a vector length n of integers (some of them are repeating), and I got a selection probability vector of the same length. How will I sample with replacement k (<=n) values with the probabilty vector. In Matlab this function is randsample. I could

Re: nonuniform sampling with replacement

2010-03-21 Thread Alf P. Steinbach
probabilities ): assert len( values ) == len( probabilities ) get2nd = operator.itemgetter( 1 ) v_p = sorted( zip( values, probabilities ), key = get2nd, reverse = True ) v_ap = []; sum = 0; for (v, p) in v_p: v_ap.append( (v, p + sum) ); sum += p

Re: accessing variable of the __main__ module

2010-03-20 Thread Alf P. Steinbach
* News123: I wondered about the best way, that a module's function could determine the existance and value of variables in the __main__ module. What I came up with is: ### main.py ## import mod A = 4 if __name__ == "__main__": mod.f() ### mod.py ## def f():

Re: Simple lock

2010-03-19 Thread Alf P. Steinbach
* MRAB: Gabriel Genellina wrote: En Fri, 19 Mar 2010 23:31:23 -0300, MRAB escribió: moerchendiser2k3 wrote: class SetPointer { private: void *ptr; MY_LOCK lock; public: void SetPointer(void *p) { Lock(this->lock); this->ptr = p; } 3.

Re: Python bindings tutorial

2010-03-19 Thread Alf P. Steinbach
* Tim Roberts: Dave Angel wrote: There's no real reason parts of an exe cannot be exported, same as a dll. They are in fact the same structure. And in fact many other files in the Windows environment are also the same structure, from fonts to ocx's This is a bit off-topic, but your explan

Re: Python bindings tutorial

2010-03-18 Thread Alf P. Steinbach
* Dave Angel: Alf P. Steinbach wrote: * Dave Angel: Stefan Behnel wrote: mikelisa...@gmail.com, 17.03.2010 10:08: Its interesting you've mentioned the hard work involved in this interface (binding to an EXE instead of a DLL). A year or more ago I was looking at interfacing IPMITOOL to p

Re: Need to create subprocess...

2010-03-18 Thread Martin P. Hellwig
On 03/18/10 16:17, drstoka wrote: Hello, I have to run a program as a child process inside my python program and redirect it's output through a pipe to a parent program process. So, I wrote this: pipe = Popen('example_program', shell=True, bufsize=0, stdout=PIPE).stdout and it works great. No

Re: import antigravity

2010-03-18 Thread Alf P. Steinbach
* Jussi Piitulainen: Alf P. Steinbach writes: The point is, if he's upset about Chris quoting that, then he's probably unaware that he's posting it in plaintext himself. The complaint was not about quoting but about using in public. Chris sent his piece to three addresses. F

Re: import antigravity

2010-03-18 Thread Alf P. Steinbach
* Stefan Behnel: Alf P. Steinbach, 18.03.2010 09:53: Path: feeder.eternal-september.org!eternal-september.org!feeder.erje.net!newsfeed.straub-nv.de!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail From: Lawrence D'Oliveiro Newsg

Re: did anybody play with python and window mobile broadband?

2010-03-18 Thread Sanjiva P.
On 03/18/2010 10:20 AM, News123 wrote: > I'm looking for examples: > - how to connect/disconnect a mobile broadband device (currently I use > rasdial. not sure it's the best solution) > - to obtain the device's current mode (GPRS / EDGE / . . . ) > - to obtain the current signal level > > Thanks

Re: import antigravity

2010-03-18 Thread Alf P. Steinbach
* Lawrence D'Oliveiro: In message , Chris Rebert wrote: I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary lapse of judgement, for which I expect an apology. Otherwise, it b

Re: multiprocessing on freebsd

2010-03-17 Thread Martin P. Hellwig
On 03/17/10 13:30, Tim Arnold wrote: Hi, I'm checking to see if multiprocessing works on freebsd for any version of python. My server is about to get upgraded from 6.3 to 8.0 and I'd sure like to be able to use multiprocessing. I think the minimal test would be: - import mult

Re: Python bindings tutorial

2010-03-17 Thread Alf P. Steinbach
* Dave Angel: Stefan Behnel wrote: mikelisa...@gmail.com, 17.03.2010 10:08: Its interesting you've mentioned the hard work involved in this interface (binding to an EXE instead of a DLL). A year or more ago I was looking at interfacing IPMITOOL to python. Do to the problems incurred with swig/py

Re: import antigravity

2010-03-16 Thread Martin P. Hellwig
On 03/16/10 19:30, Hans Mulder wrote: Ulrich Eckhardt wrote: Chris Rebert wrote: You're a bit behind the times. If my calculations are right, that comic is over 2 years old. import timetravel I think you mean: from __future__ import timetravel -- HansM Well according to Marty it is: fr

Re: import antigravity

2010-03-16 Thread Alf P. Steinbach
* Ulrich Eckhardt: Chris Rebert wrote: You're a bit behind the times. If my calculations are right, that comic is over 2 years old. import timetravel C:\test> python Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credi

Re: dll in project?

2010-03-15 Thread Alf P. Steinbach
* Alex Hall: On 3/15/10, Ulrich Eckhardt wrote: Alex Hall wrote: I have a dll I am trying to use, but I get a Windows error 126, "the specified module could not be found". Here is the code segment: nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") In addition to Alf's ans

Re: File existence check with partial filename

2010-03-14 Thread Alf P. Steinbach
* Sang-Ho Yun: I learned that I can check the existence of a file using os.path.isfile("filename"). What if I need to check if there is a file that contains "HV" in the filename? What should I do? from __future__ import print_function import os for filename in os.listdir( "." ):

Re: dll in project?

2010-03-14 Thread Alf P. Steinbach
* Alex Hall: Hi all, I have a dll I am trying to use, but I get a Windows error 126, "the specified module could not be found". Here is the code segment: nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") I have the specified dll file in the same directory as the file

Re: Python unicode and Windows cmd.exe

2010-03-14 Thread Alf P. Steinbach
* Mark Tolonen: "Terry Reedy" wrote in message news:hnjkuo$n1...@dough.gmane.org... On 3/14/2010 4:40 PM, Guillermo wrote: Adding the byte that some call a 'utf-8 bom' makes the file an invalid utf-8 file. Not true. From http://unicode.org/faq/utf_bom.html: Q: When a BOM is used, is it o

Re: xml-rpc

2010-03-14 Thread Martin P. Hellwig
On 03/14/10 10:32, hackingKK wrote: Instead of using the library directly, isn't python-twisted a better choice? Why? -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: xml-rpc

2010-03-14 Thread Martin P. Hellwig
On 03/14/10 08:14, ahmet erdinc yilmaz wrote: Hello, Recenetly we are developing a senior project and decide to use xmlrpclib. However I have some questions. In the documentation I could not find any clue about handling requests? Does the server handles each request in a separate thread? Or is t

Re: python to exe

2010-03-13 Thread Martin P. Hellwig
On 03/13/10 19:23, Steven D'Aprano wrote: On Sat, 13 Mar 2010 12:52:39 -0600, John Bokma wrote: For quite some time I thought that comp.lang.perl.misc was quite unfriendly because of a certain attitude. comp.lang.python was quite a refreshment for a while: very newbie friendly, less pissing con

Re: python to exe

2010-03-13 Thread Alf P. Steinbach
* Gib Bogle: Steven D'Aprano wrote: As the old proverb goes: give a man a fish, and you feed him for a day. Teach him how to fish, and he has food forever. I like this version: Light a man a fire, and you keep him warm for hours. Set a man on fire, and you keep him warm for the rest of his

Re: Threading, Queue for a function so it only runs once at a time.

2010-03-12 Thread John P.
On Fri, 12 Mar 2010 16:49:04 +, "John P." wrote: > On Fri, 12 Mar 2010 11:22:04 -0500, "D'Arcy J.M. Cain" > wrote: >> On Fri, 12 Mar 2010 15:56:12 + >> "John P." wrote: >>> Sorry but its not really an option for me with P

Re: Threading, Queue for a function so it only runs once at a time.

2010-03-12 Thread John P.
On Fri, 12 Mar 2010 11:22:04 -0500, "D'Arcy J.M. Cain" wrote: > On Fri, 12 Mar 2010 15:56:12 + > "John P." wrote: >> Sorry but its not really an option for me with PostgreSQL. Thanks anyway. > > Why? It's your best option. Any other solut

Re: Threading, Queue for a function so it only runs once at a time.

2010-03-12 Thread John P.
ons running at once, MySQL is a terrible choice. > Give PostgreSQL a try. It does a much better job with that kind of > load. > > On Thu, Mar 11, 2010 at 11:11 PM, John P. > wrote: >> Hi, >> >> Im programming a simple webcrawler with threading for the fun of it, >

Threading, Queue for a function so it only runs once at a time.

2010-03-12 Thread John P.
here? Thanks. -- John P. -- http://mail.python.org/mailman/listinfo/python-list

Re: inspect.stack() and frame

2010-03-11 Thread Alf P. Steinbach
* Félix-Antoine Fortin: Given this code : # Experience with frame import sys import inspect def foo(): stack = inspect.stack() print "foo frame : " + str(hex(id(sys._getframe( hex returns a string. applying str is therefore redundant. def foo2(): inspect.stack() print "f

Platform Requirement Checker (was Does this already exists?: A module that checks if the used platform is supported)

2010-03-11 Thread Martin P. Hellwig
On 03/11/10 01:37, Gabriel Genellina wrote: En Wed, 10 Mar 2010 10:54:27 -0300, Martin P. Hellwig escribió: Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the

Re: Where can I find documentation for data[:,9]

2010-03-11 Thread Martin P. Hellwig
On 03/11/10 22:08, Cal Who wrote: Thanks, that helped a lot. I'm having trouble knowing what to search for to find documenatation. For example, is print a Python command, a numpy command or a java command? I like to read the documentation even if the command is working for me. Thanks again

Re: Ideas for creating processes

2010-03-10 Thread Martin P. Hellwig
On 03/10/10 21:52, J wrote: I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) Well I can't speak with authority but I would go into similar lines, especially since you want to call an externa

Re: Named loops for breaking

2010-03-10 Thread Alf P. Steinbach
* James Harris: On 10 Mar, 06:29, "Gabriel Genellina" wrote: En Tue, 09 Mar 2010 18:41:10 -0300, Daniel Klein escribi : Basically I'm wondering if there are any plans to implemented named loops in Python, so I can tell a break command to break out of a specific loop in the case of nested l

Does this already exists?: A module that checks if the used platform is supported

2010-03-10 Thread Martin P. Hellwig
Hi all, Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the platform + version is supported for what I want to do with it. For example I am currently looking at mak

Re: equivalent of Ruby's Pathname?

2010-03-09 Thread Martin P. Hellwig
On 02/09/10 14:00, Phlip wrote: Ah, now we get down to the root of the problem. Because Python is so stuck on the "one best way to do it" mentality, language bigotry prevented the Committee from picking from among several equally valid but non-best options. And after 20 years of growth, Python s

Re: String is ASCII or UTF-8?

2010-03-09 Thread Alf P. Steinbach
* C. Benson Manica: Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? This is python 2.4.3, so I don't have getsizeof available to me. Generally, i

Re: Trouble with quotes

2010-03-08 Thread Martin P. Hellwig
On 03/08/10 17:06, Stephen Nelson-Smith wrote: Hi, I've written some (primitive) code to parse some apache logfies and establish if apache has appended a session cookie to the end. We're finding that some browsers don't and apache doesn't just append a "-" - it just omits it. It's working fine

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