Re: WINXP vs. LINUX in threading.Thread

2009-04-22 Thread Diez B. Roggisch
Kent schrieb: hello all, i want to add a "new update notification" feature to my wxPython appl. The codes below do the job. The logic is simple enough, I don't think it needs to be explained. since sometimes, under windows, proxy setting was a script. and was set in IE. In this case, connecting

Re: Weird lambda behavior

2009-04-22 Thread Diez B. Roggisch
Rüdiger Ranft wrote: > Hi all, > > I want to generate some methods in a class using setattr and lambda. > Within each generated function a name parameter to the function is > replaced by a string constant, to keep trail which function was called. > The problem I have is, that the substituted name

Re: What is the best framework or module in Python for a small GUI based application development?

2009-04-22 Thread Diez B. Roggisch
srinivasan srinivas wrote: > > Thanks for the info. > My requirement is to write an application which is GUI based has to run on > browsers. Could you tell me which one would be suitable for this? There is no GUI-framework on browsers. There is HTML/CSS + JS, which is produced by servers that ca

Re: Export variables

2009-04-21 Thread Diez B. Roggisch
mso...@linuxmail.org wrote: > Hello, > > I want to make a certain subset of public attributes available through > an interface. > > The client should not need to know the names of the attributes. > > Here is some code with the important parts missing. Anyone care to > fill in the missing parts

Re: the correct way to install python packages as non root user in non default path

2009-04-21 Thread Diez B. Roggisch
News123 wrote: > Hi Alex, > > > Thanks a lot. Reading the description this sounds to be the right thing. > > > But now I'm stuck installing virtualenv as a user as this seems to be no > ubunbtu package: > > > export PYTHONPATH=/opt/newpymod/lib/python2.5/site-packages > mkdir -p $PYTHONPATH

Re: getter and setter and list appends

2009-04-20 Thread Diez B. Roggisch
dasacc22 wrote: > Hi, > > I seem to be having a problem with a list being share across multiple > instantiations of it and dont quite understand why this is happening. > > My class looks like this, > > class Widget(object): > _parent = None > _children = [] > > def __init__(self, p

Re: Python and GMP.

2009-04-20 Thread Diez B. Roggisch
alessiogiovanni.bar...@gmail.com wrote: > There are reasons why Python not used the GMP library for implementing > its long type? Any reason it should? I don't know GMP (only that it exists), but adding binary dependencies is always a tricky and in need of careful weighting thing to do. Diez --

Re: sorting two corresponding lists?

2009-04-20 Thread Diez B. Roggisch
Esmail wrote: > Hello all, > > I wonder if someone could help me with sorting two corresponding lists. > > For instance the first list contains some items, and the second list > contains their value (higher is better) > > items = [apple, car, town, phone] > values = [5, 2, 7, 1] > > I would li

Re: Keyerror addhandler

2009-04-19 Thread Diez B. Roggisch
Steven Macintyre schrieb: Hi all, I'm wondering if anyone can assist me with this as I am very confused about it now. I am getting the following error; Traceback (most recent call last): File "/usr/lib/python2.4/logging/config.py", line 191, in fileConfig logger.addHandler(handlers[hand]

Re: pyqt4 qTableWidget add items help

2009-04-18 Thread Diez B. Roggisch
ookrin schrieb: I've been searching around the internet for an example of how to add a list of items to the qTableWidget for the last few hours with little success. I have a list orders [[34,940,30,50,67], [50,56,35,30,57]] as my example here I built the qTableWidget in designer, so it already

Re: Inheriting dictionary attributes and manipulate them in subclasses

2009-04-17 Thread Diez B. Roggisch
Dominik Ruf wrote: > Hi, > > I just stumbled upon the following behaviour. class base(): > ... dic = {'1':'1', '2':'2'} > ... class child1(base): > ... def __init__(self): > ... self.dic.update({'1':'2'}) > ... class child2(base): > ... pass > ... c1 = child1()

Re: QT , Wxwidgets are not just UI framework ?

2009-04-17 Thread Diez B. Roggisch
Deep_Feelings wrote: > On Apr 17, 1:52 pm, "Diez B. Roggisch" wrote: >> Deep_Feelings wrote: >> > qt include many libraries : network , threading,database ..etc while >> > Wxwidgets seem similar but with less scope >> >> > my question is :

Re: QT , Wxwidgets are not just UI framework ?

2009-04-17 Thread Diez B. Roggisch
Deep_Feelings wrote: > qt include many libraries : network , threading,database ..etc while > Wxwidgets seem similar but with less scope > > my question is : does these frameworks replace python's (or any other > language for that matter) built-in libraries ? or python does not > include that sor

Re: pyqt4: setText() inside a function

2009-04-16 Thread Diez B. Roggisch
l.fres...@gmail.com schrieb: I'm developing a PyQt4 application. I have created a button: ... self.start_button=QtGui.QPushButton("start simulation", self) ... that is connected to a function: ... self.connect(self.start_button, QtCore.SIGNAL('clicked()'), self.simulate) ... This is the functi

Re: Reading an exact number of characters from input

2009-04-16 Thread Diez B. Roggisch
Paddy O'Loughlin schrieb: Hi, How would I use python to simply read a specific number of characters from standard input? raw_input() only returns when the user inputs a new line (or some other special character). I tried import sys sys.stdin.read(15) and that *returns* up to 15 characters, bu

Re: setuptools catch 22

2009-04-16 Thread Diez B. Roggisch
Mac schrieb: We've got ActiveState Python 2.6 installed on a Windows XP box, and I pulled down the latest archgenxml package (2.2) in order to get it running under this installation of Python. I unpacked the tarball for the package and tried running `python setup.py build' but got an ImportError

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Diez B. Roggisch
Rüdiger Ranft schrieb: Diez B. Roggisch schrieb: Rüdiger Ranft schrieb: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output

Re: Is there any way to find out the definition of a function in a file of C language?

2009-04-16 Thread Diez B. Roggisch
Jebel schrieb: Hi ,everyone. I have the name of a function of C language, and have the source file which the function is defined in. And I want to find out the type and name of the parameters. If I need to analyze the file by myself, or have some way to do it more easily? Google for ctypes and

Re: Question to python C API

2009-04-16 Thread Diez B. Roggisch
it is possible to write C and python code into the same file ? Not as such. And JNI is an atrocity, btw. But what you can do (if you have a pure C-API, no C++) is to completely ditch the C from the equation and go for ctypes. This allows you to easily wrap the C-functions i

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Diez B. Roggisch
Rüdiger Ranft schrieb: Hi all, I need to call some programms and catch their stdout and stderr streams. While the Popen class from subprocess handles the call, I get the results of the programm not until the programm finishes. Since the output of the programm is used to generate a progress indic

Re: segmentation fault while using ctypes

2009-04-15 Thread Diez B. Roggisch
> > Thanks Diez, > > I used the gdb but it just crashed and kicked my out of gdb prompt. > how can I get a stack trace? That's odd, has never happened for me before. Can you show us what you do exactly, and what gdb & co say? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: segmentation fault while using ctypes

2009-04-14 Thread Diez B. Roggisch
sanket schrieb: Hello All, I am dealing with this weird bug. I have a function in C and I have written python bindings for it using ctypes. I can call this function for couple of times and then suddenly it gives me seg fault. But I can call same function from a C code for any number of times.

Re: Play sound at wanted frequency

2009-04-14 Thread Diez B. Roggisch
Matteo schrieb: I need to playback a sound on a linux machine of a pre-determined frequency like, say, 440 Hz. How can I do that with python? I found the ossaudiodev package, but it says that the ossaudiodev.write() method accepts data as a raw string. It doesn't explain what the string should be

Re: Automatically generating arithmetic operations for a subclass

2009-04-14 Thread Diez B. Roggisch
andrew cooke wrote: > Arnaud Delobelle wrote: >> I do this: >> >> binops = ['add', 'sub', 'mul', 'div', 'radd', 'rsub'] # etc >> unops = ['neg', 'abs', invert'] # etc >> >> binop_meth = """ >> def __%s__(self, other): >> return type(self)(int.__%s__(self, other)) >> """ >> >> unop_meth = """ >

Re: Should we separate business logic and ORM mapping classes?

2009-04-14 Thread Diez B. Roggisch
一首诗 wrote: > Hi, > > ( First, this is not a question about if we should use ORM. It's > question for these who are already using it. ) > > Usually, I only use ORM, like sqlalchemy just as an abstraction layer > of > database. So these mapping objects I wrote only contains data but not > behav

Re: ctypes - random access to address space

2009-04-14 Thread Diez B. Roggisch
janislaw schrieb: Hi, I am currently doing a project in which I interface to a PCI card. To ease the prototyping, I call the API functions, which map the address space of the card to a process memory. I acquire the location in the process memory mapped to an address space using card API, result

Re: REG: python c++ bindings

2009-04-13 Thread Diez B. Roggisch
ext-golla.anil-ku...@nokia.com schrieb: Hi Please don't reply to existing posts. People read news and mails threaded, and this makes a post appear below other, non-related posts & causes confusion. Create a new thread instead, by directly posting to the group or ML. I need some materia

Re: Who is your daddy: Can I find what object instantiates another object?

2009-04-13 Thread Diez B. Roggisch
hubritic schrieb: I want to build a parser object that handles two different log file formats. I have an object that handles Connection logs and an object for Filter logs. Each will instantiate a Parser object, passing in the path to individual log files. There are a number of ways I could fig

Re: Unsupported operand types in if/else list comprehension

2009-04-12 Thread Diez B. Roggisch
Mike H schrieb: Sigh. One more. And again, thank you for all of the help. I realized that the last version that I posted took care of an SQL injection problem for the values, but not for the fields. So, I went ahead and modified the code: def new_insert_cmd(myTable, myFields, myValues): """

Re: Python and XML Help

2009-04-12 Thread Diez B. Roggisch
ookrin schrieb: I'm in the process of learning python and PyQt4. I had decided to make myself a simple app and soon discovered that I needed to crash into xml to use some of the data I was going to be getting off of the server. I picked up enough xml to use the sax parser to get the data out of

Re: Writing a "Raw" Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch
MRAB schrieb: Diez B. Roggisch wrote: W. eWatson schrieb: Diez B. Roggisch wrote: W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: bands: ('P',) type: I'd like to write it to a file. Apparently, I

Re: Writing a "Raw" Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch
W. eWatson schrieb: Diez B. Roggisch wrote: W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. H

Re: Writing a "Raw" Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch
W. eWatson schrieb: I have an image of described as: Img Info: {} size: (640, 480) format: None mode: P palette: bands: ('P',) type: I'd like to write it to a file. Apparently, I need to convert it to a string first. How do I do that? Pickle? Did you bother reading the PIL docu

Re: Multithreading / multiprocess

2009-04-11 Thread Diez B. Roggisch
tleeuwenb...@gmail.com schrieb: Is there anyway to begin a thread and execute a finite number of lines of code, or a finite amount of time within it? For example, say I create three child threads and I want to guarantee equal timeshare between them, can I specify a quanta (say 400 LOC although I

Re: storing variable value

2009-04-11 Thread Diez B. Roggisch
Daniel Dalton schrieb: Hi! I'm writing a program to provide me with battery warnings when my battery hits certain levels. It just checks the current level and does something. I plan to call it from a a cron job. But If the cron runs every minute, warnings every minute would be rather annoying. s

Re: Unsupported operand types in if/else list comprehension

2009-04-11 Thread Diez B. Roggisch
Mike H schrieb: Thanks to all of you. FYI, I'm doing this because I'm working on creating some insert statements in SQL, where string values need to be quoted, and integer values need to be unquoted. I wanted to be sure that I could pass these values to the list in a normal way e.g. ['test', 1,

Re: Running an interactive subprocess with Popen

2009-04-10 Thread Diez B. Roggisch
David Liang schrieb: Hello, Sorry for the newbie question. How do I run a program that could block, waiting for user input, using subprocess.Popen? For example, from subprocess import * def foo(): a = Popen(['python'] ...) I want to be able to get input from the user and send input to the

Re: Floor value in math operators

2009-04-08 Thread Diez B. Roggisch
> > In python2.6 and 3.x, the new behavior is standard. Apparently that is nonsense - it seems to be not standard for 2.6. Which Makes sense I guess. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Floor value in math operators

2009-04-08 Thread Diez B. Roggisch
Avi wrote: > Hi, > > This will be a very simple question to ask all the awesome programmers > here: > > How can I get answer in in decimals for such a math operator: > > 3/2 > > I get 1. I want to get 1.5 You don't say which python-version you have. Depending on that, the answer is different.

Re: How to go about. On read/write locks

2009-04-06 Thread Diez B. Roggisch
Python's approach with the GIL is both reasonable and disappointing. Reasonable because I understand how it can make things easier for its internals. Disappointing because it means that standard python cannot take advantage of the parallelism that can more and more often be afforded by today's com

Re: How to go about. On read/write locks

2009-04-06 Thread Diez B. Roggisch
This is a classical synchronization problem with a classical solution: You treat the readers as a group, and the writers individually. So you have a write lock that each writer has to acquire and release, but it is acquired only by the first reader and released by the last one. Therefore you need

Re: decorators don't play nice with nose?

2009-04-06 Thread Diez B. Roggisch
hyperboreean schrieb: Hi, I am trying to test the business part of a web service. For this I am using unittest & nose. I wrote a decorator that should handle the xml test file retrieval, but it seems I can't get it working with nose. Here's the code: * MyApp.py -- base test class * import os

Re: exporting symbols with ctypes?

2009-04-06 Thread Diez B. Roggisch
Brian schrieb: I'd like to load a library that expects executables which link against it to provide a particular symbol. Is there a way to do the inverse of the in_dll() operation? I'd prefer to avoid creating a brand new library on the fly just to satisfy this one dependency. Maybe elmer can

Re: How to go about. On read/write locks

2009-04-05 Thread Diez B. Roggisch
Emanuele D'Arrigo schrieb: Hi everybody, I'm having a threading-related design issue and I suspect it has a name that I just don't know. Here's a description. Let's assume a resource (i.e. a dictionary) that needs to be accessed by multiple threads. A simple lock will do the job but in some ci

Re: with open('com1', 'r') as f:

2009-04-04 Thread Diez B. Roggisch
gert schrieb: On Apr 3, 10:10 pm, Christian Heimes wrote: gert wrote: I do understand, and I went looking into pySerial, but it is a long way from getting compatible with python3.x and involves other libs that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are stil

Re: python needs leaning stuff from other language

2009-04-04 Thread Diez B. Roggisch
Tim Wintle schrieb: On Sat, 2009-04-04 at 02:03 -0500, Robert Kern wrote: Let's be clear: python-ideas seems positive on the idea of adding a .clear() method. *Completely removing* slice assignment has not been broached there. Yup, sorry - I did mean to refer to the initial suggestion, rather

Re: Undefined symbol PyUnicodeUCS2_DecodeUTF8

2009-04-04 Thread Diez B. Roggisch
Manish Jain schrieb: Hi all, I am using Gnome on FreeBSD 7.1. A few days back, my gnome crashed and I have had to spend over 4 days recovering my gnome environment. Pretty much everything is okay now except for a few python-dependent applications (alacarte, for instance), which exit immediat

Re: Iteratoration question

2009-04-03 Thread Diez B. Roggisch
while what you are doing is interesting, it is not the same as Python's iterators, which use "yield" from a function and don't require storing a value in a class. look for "yield" in the python docs. this comment may be irrelevant; i am just worried you are confusing the above (which apart from

Re: python needs leaning stuff from other language

2009-04-02 Thread Diez B. Roggisch
online.serv...@ymail.com schrieb: python's list needs a thing list.clear() like c# arraylist and some_list[:] = [] python needs a writeline() method print() Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a PIL image object to a buffer

2009-04-02 Thread Diez B. Roggisch
Simon Hibbs schrieb: On 1 Apr, 21:43, Gary Herron wrote: Simon Hibbs wrote: I'm trying to dump a snapshot of my application window to the clipboard. I can use ImageGrab in PIL to get the screen data into a PIL image object, which i have converted to a bitmap using ImageWin, but when I try to p

Re: Display directory pyqt4 and Python

2009-04-02 Thread Diez B. Roggisch
Dunwitch schrieb: I've looked around for the answer and have decided to ask an expert for the solution. Whats suppose to happen is a user pushes a button and displays the directory content in the text edit window on the gui. Everything works, apart from the fact that it only shows the last file i

Re: python for loop

2009-04-01 Thread Diez B. Roggisch
Lada Kugis schrieb: On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano wrote: Why Python (and other languages) count from zero instead of one, and why half-open intervals are better than closed intervals: http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/ http://www.

Re: Read Garmin XML (TCX) files in Python...

2009-03-29 Thread Diez B. Roggisch
cmalmqui schrieb: Dear All, Garmin uses XML as an exchange format for their Forerunner GPS series (http://developer.garmin.com/schemas/tcx/v2/) and I have been thinking about creating a python script that parses the Garmin XML file and dumps the training information to a KML file as well as vario

Re: help needed on loop controls

2009-03-29 Thread Diez B. Roggisch
Gaudha schrieb: Hi Pythons I have got some problems with exiting and continuing nested loops. Some solving ideas found somewhere like http://offog.org/ideas/python-loop-exit.html. I searched in depth of the Official Python Documentation and couldn't find any like that. Did that ideas implemente

Re: Setting an exclusive lock on a file

2009-03-29 Thread Diez B. Roggisch
Eugene Perederey schrieb: Hi all, I want to set an exclusive lock on a file so other processes wouldn't be able to write to it. So I write import fcntl fd=open('myfile','w') fcntl.lockf(fd, fcntl.LOCK_EX) fd.write('some bytes') fd.close() But it turns out that my script doesn't write anything t

Re: Setting an exclusive lock on a file

2009-03-29 Thread Diez B. Roggisch
Eugene Perederey schrieb: Hi all, I want to set an exclusive lock on a file so other processes wouldn't be able to write to it. So I write import fcntl fd=open('myfile','w') fcntl.lockf(fd, fcntl.LOCK_EX) fd.write('some bytes') fd.close() But it turns out that my script doesn't write anything t

Re: Psycopg Documentation

2009-03-29 Thread Diez B. Roggisch
taliesin schrieb: Hi, I'm probably being very dense so apologies in advance, but I can't find any decent documentation for the psycopg module for PostgreSQL interfacing. Google and Yahoo don't seem to return much for any of the queries I gave them and what's listed as the homepage for psycopg i

Re: if there is a return type of a method definition like java does

2009-03-28 Thread Diez B. Roggisch
Coonay schrieb: if there is a return type of a method definition,that would lead to faster decision to do with the method called,do you think so? No, because python has no overloaded methods - there is just one method called. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Puzzling: local variable in recursive function made global?

2009-03-26 Thread Diez B. Roggisch
Daniel Oberski schrieb: Hello all, I wrote this function to recurse through a tree structure of Nodes connected by Branches. I use a local variable seen_nodes to mark off Nodes already seen by the function (i.e. add them to a list). That's not a local variable, that is a default argument.

Re: Is there a simple soap library for python?

2009-03-26 Thread Diez B. Roggisch
李田 schrieb: To emluate a soap service or client. http://72.249.21.88/nonintersecting/?year=2006&monthnum=11&day=15&name=the-s-stands-for-simple&page= There is no such thing as a "simple soap library". Neither for Python, nor for any other language.. If you can, use something different. O

Re: How to use self-inspection to check for try-block

2009-03-20 Thread Diez B. Roggisch
el...@cmbi.ru.nl schrieb: On Mar 20, 10:16 am, Chris Rebert wrote: On Fri, Mar 20, 2009 at 2:09 AM, wrote: On Mar 20, 9:44 am, Chris Rebert wrote: On Fri, Mar 20, 2009 at 1:32 AM, wrote: Hi everyone, is there a sufficiently easy possibility for a Python function to find out whether it h

Re: How to use Jython to create a javabean ???

2009-03-20 Thread Diez B. Roggisch
qq13234...@gmail.com schrieb: I want to make a bean with Jython and how to make it via Jython ? By subclassing a java interface. That's all you need. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with threading: can't start new thread

2009-03-11 Thread Diez B. Roggisch
sufrank wrote: > I am doing stress test with python using threading, I have encountered > the can't start new thread problem when running the script. > The system is Linux, python version 2.4 http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux Diez -- http://

Re: Any c header parser for generate ctypes module?

2009-03-09 Thread Diez B. Roggisch
Victor Lin wrote: > Hi, > > I am writing python binding for some c library. It is really a super > boring job. Copy... paste... modify.. copy paste...modify I am > wondering, I am a programmer, why I can't do this job like a > programmer? So I think the best way to write binding for those c >

Re: NEWB: dividing numbers

2009-03-08 Thread Diez B. Roggisch
Lo schrieb: I just tried python first time. 2/3 the result is zero I want the result to be .333... Well, that's not going to happen - 2/3 is .666 if not done with integers... How do I get this? Use floating points. >>> 2.0 / 3.0 0.3 Diez -- http://mail.python.org/mailma

Re: Set & Frozenset?

2009-03-08 Thread Diez B. Roggisch
Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by key. But

Re: Callback from c thread with ctypes

2009-03-08 Thread Diez B. Roggisch
Victor Lin schrieb: Hi, I am going to develop a c library binding with ctypes. That c library will call callback from worker threads it created. Here comes the problem : Will the GIL be acquired before it goes into Python function? I got a little try.. DSPPROC = WINFUNCTYPE(None, DWORD, DWORD,

Re: Should I use stackless python or threads?

2009-03-07 Thread Diez B. Roggisch
John Nagle schrieb: Minesh Patel wrote: On Fri, Mar 6, 2009 at 3:16 PM, Jean-Paul Calderone wrote: On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel wrote: I am trying to figure out the best approach to solve this problem: I want to poll various directories(can be run in the main thread). Onc

Re: This should be a simple question...

2009-03-06 Thread Diez B. Roggisch
Neal Becker schrieb: Maybe I'm missing something obvious here def A (...): #set a bunch of variables x = 1 b = 2 ... Do something with them def B (...): #set the same bunch of variables x = 1 b = 2 ... Do something with them I want to apply DRY, and extract out the common set

Re: random module gives same results across all configurations?

2009-03-04 Thread Diez B. Roggisch
Paul Rubin schrieb: "Diez B. Roggisch" writes: Random uses AFAIK rand/srand from the stdlib.h of your platform (*nix, no idea how that beast is called in redmond). According to http://docs.python.org/library/random.html it uses Mersenne Twister. Yeah, I figured that out later,

Re: random module gives same results across all configurations?

2009-03-04 Thread Diez B. Roggisch
So far I get the same results under Mac OS X, Windows, and Linux (Google App Engine). I'm particularly interested in getting the same results under the Google App Engine even as Google upgrades its servers over time. I just had a look into the python source - and I was wrong, it appears rando

Re: Packaging modules with Bundlebuilder

2009-03-03 Thread Diez B. Roggisch
DLitgo schrieb: Hello everyone, I'm curious about creating .app files for the mac using bundlebuilder (or py2app or even py2exe). I'm just about done creating a GUI for a little set of scripts which basically perform batch image editing. If I send this app to friends and family will they be abl

Re: random module gives same results across all configurations?

2009-03-03 Thread Diez B. Roggisch
Amir Michail schrieb: On Mar 3, 10:05 pm, Chris Rebert wrote: On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail wrote: Hi, Is it the case that the random module will always give the same results if given the same seed across all configurations (e.g., architectures, compilers, etc.)? Your question

Re: Opening for Python Programmer at Newport Beach

2009-03-03 Thread Diez B. Roggisch
Is your email program broken or what? Why are you sending the same exact message 5 times!? Not to mention that the name "Cool Dude" isn't exactly convincing me that I should apply for a job there... Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Shared library Python on Mac OS X 64-bit

2009-03-03 Thread Diez B. Roggisch
Uberman schrieb: Graham Dumpleton wrote: Why don't you want to use MacOS X Framework libraries? It is the better installation method. Because I'm not installing Python, I'm building it. If I were just interested in installing Python, I wouldn't care whether it was static or shared libraries.

Re: HTTPError... read the response body?

2009-03-03 Thread Diez B. Roggisch
Stuart Davenport schrieb: On Mar 2, 11:50 pm, Wojtek Walczak wrote: On Mon, 2 Mar 2009 14:29:12 -0800 (PST), Stuart Davenport wrote: Hi, I am trying to connect to a web service but I am getting HTTP 400, I am not too concerned about the HTTP error - but what I'd like to know if there is anyw

Re: yaml for persistence

2009-03-03 Thread Diez B. Roggisch
Paul schrieb: class User(object): def __init__(self, uid): self.uid = uid self.__dict__.update(yaml.load(str('uid')+'.yaml')) def save(self): f=open(str(self.uid)+'.yaml') yaml.dump(self.__dict__, f) is there a better way to persist using Yaml Paul http:

Re: Upgrade Python on a Mac

2009-03-03 Thread Diez B. Roggisch
Wes James schrieb: On Mon, Mar 2, 2009 at 2:53 PM, Rey Bango wrote: Hi, I'd like to upgrade the installed version of Python that came standard on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot in it, I just wanted to get a better understanding of the process. I'd recommend

Re: Can CleintForm work with webbrowser?

2009-03-01 Thread Diez B. Roggisch
Muddy Coder schrieb: Hi Folks, ClientForm is cool at grabbing and parsing stuff from server, I like it. After the stuff parsed, and even filled values for the Controls, I popped up an idea of displaying what I had done with webbrowser. Look at the code: import ClientForm import urllib2 import w

Re: python sql query in django

2009-02-25 Thread Diez B. Roggisch
for a introduction to the multitude of query-options. I doubt that your rather simple m:n-relationship is covered there. s/is/isn't/ Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: python sql query in django

2009-02-25 Thread Diez B. Roggisch
I think Django is fabulous for the admin-interface, a simple text search and template inheritance. I will use Django for all of those. What I'm not getting an answer to and cannot find an example of is a complex search, where I have to retrieve data from multiple tables, combine the data, remove

Re: "Battleship" style game

2009-02-25 Thread Diez B. Roggisch
Shawn Milochik schrieb: On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: Not really. The point about properties is that you *can* make attribute access trigger getter or setter code. But not that you do unless there is an actual reason for that. The way you do it now is simply

Re: "Battleship" style game

2009-02-25 Thread Diez B. Roggisch
Shawn Milochik schrieb: Thanks. I wasn't aware of the property() function, but I read up on it. I modified the Vessels.py file, but not the board file (except where necessary to handle the changes made to Vessels. Is this better? http://shawnmilo.com/ships/ships2/ Not really. The point about

Re: python sql query in django

2009-02-24 Thread Diez B. Roggisch
Thanks for all your suggestions. From what I've experienced in Django and now that I know a little more about how Python functions, I will probably use a combination of PHP and Django, instead of trying to get Python to do the web portion of my project. Thanks again! That sounds like the wors

Re: python sql query in django

2009-02-23 Thread Diez B. Roggisch
I may not stay with Django. I am seriously looking for whether python can read data from a relational database and send to an html template or do I always need some kind of wrapper/interface such as Rails or Django? If this is the wrong group to ask that question could you recommend another pyth

Re: Extending Python Questions .....

2009-02-23 Thread Diez B. Roggisch
Ben schrieb: Ok... Now I can start asking. In My S-Lag Project called, SLAG, I have some function keys that get mapped back to S-lang internal functions. My SLAG project works pretty much like Python (as does the S-Lang). You write a S-lang script that "imports" your extension. module - and all

Re: pysqlite smart search

2009-02-23 Thread Diez B. Roggisch
klia schrieb: klia wrote: Hey guys; I am trying to develop a tiny program using python to search inside sqlite database with file extension is .db in which the program will ask users to enter their search query and base on that it will retrieve the results But I need the program to have som

Re: shared lib from python code?

2009-02-23 Thread Diez B. Roggisch
Gabriel Rossetti schrieb: Gabriel Rossetti wrote: Hello everyone, I would like to know if it is possible to turn python code into a shared lib? I have several processes that use the same base code, and it seems like every process loads the "shared" code into memory. I would like it to be loa

Re: Musings: Using decorators to reduce duplicate exception handling

2009-02-22 Thread Diez B. Roggisch
J Kenneth King schrieb: I recently started a project called TracShell (http://code.google.com/p/tracshell) where I make heavy use of the xmlrpclib core module. When the number of RPC calls was small, wrapping each call in try/except was acceptable. However, this obviously will duplicate code all

Re: why do I get name not defined error

2009-02-18 Thread Diez B. Roggisch
zaheer.ag...@gmail.com schrieb: Hi, I have the following declared in my class, I am trying tp call a method defined in the same class I am not sure why I am getting name not defined error if options.uploadFile != None : print "This is path", the_rest filePath = the_rest

Re: how to detect if an object is "simple" (not a pointer, unmutable ) ?

2009-02-17 Thread Diez B. Roggisch
Stef Mientki schrieb: hello, I'm making a virtual machine, in which (small) pieces of software (called bricks) are connected, by connecting an output of a brick to the input of another brick. A connection between 2 bricks may be of any type, so it might be simple integer, or a multi-nested dict

Re: Is there something easier than ORM?

2009-02-17 Thread Diez B. Roggisch
一首诗 schrieb: Hi all, Recently I am studying some python ORM libraries, such as sqlalchemy. These are very powerful technologies to handle database. But I think my project are not complicated to enough to benefit from a complete ORM system. What I really want, is some easy ways to load data fr

Re: print string as raw string

2009-02-17 Thread Diez B. Roggisch
Mirko Dziadzka schrieb: Hi all I'm trying to find a way to output strings in the raw-string format, e.g. print_as_raw_string(r"\.") should output r"\." instead of "\\." Is there a better way than writing your own print function? Some magic encoding? There is no need to do this. Rawstrings ar

Re: wxPython and Croatian characters

2009-02-16 Thread Diez B. Roggisch
vedrandeko...@gmail.com schrieb: Hello, I have problem with configuring my wxPython script to work with Croatian characters like: đ,š,ž,č,ć. Here is my simple script without wxPython (this script works): # -*- coding: utf-8 -*- s = "hello normal string đšžćč" print s ..here

Re: pythojn/xpath question...

2009-02-16 Thread Diez B. Roggisch
bruce schrieb: hi... using libxml2dom as the xpath lib i've got a situation where i can have: foo=a.xpath( /html/body/table[2]/tr[45]/td) and i can get 11 as the number of returned td elements for the 45th row... this is as it should be. however, if i do: foo=a.xpath( /html/body/table[2]/t

Re: logging and daemons

2009-02-16 Thread Diez B. Roggisch
Fernando M. Maresca schrieb: Hello. I'm in the process of replacing a custom logger class in one of my apps that has several daemons. In the last step of daemonizing a program, after closing fds, stderr and stdout are redirected to the logfile of the program. Now, I'm trying to use TimedRotatin

Re: What is a phyton?

2009-02-16 Thread Diez B. Roggisch
Thorsten Kampe schrieb: * (Mon, 16 Feb 2009 05:45:09 -0800 (PST)) is phyton a programming language? http://en.wikipedia.org/wiki/Phyton Thanks for quoting the OPs spam name so that the visibility of his post is increased. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: python in emacs

2009-02-15 Thread Diez B. Roggisch
kentand...@sbcglobal.net schrieb: When I visit a file with extension .py, emacs says "loading python...done", and gives me a "python" menu with options like "start interpreter" and "eval buffer". When I try to use one of these options emacs says "loading compile...done", then hangs and has to be

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Diez B. Roggisch
Hrvoje Niksic schrieb: "Diez B. Roggisch" writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't work on 64-bit architectures, nor does it work when

Re: Easier to wrap C or C++ libraries?

2009-02-14 Thread Diez B. Roggisch
argo...@gmail.com schrieb: When creating a Python binding to a C or C++ library, which is easier to wrap, the C lib or the C++ one? Given a choice, if you had to choose between using one of two libs, one written in C, the other in C+ + -- both having approximately the same functionality -- which

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