Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-25 Thread Diez B. Roggisch
Evan Driscoll schrieb: On Aug 25, 2:33 pm, Evan Driscoll wrote: I want to make a context manager that will temporarily change the value of a variable within the scope of a 'with' that uses it. This is inspired by a C++ RAII object I've used in a few projects. Ideally, what I want is something l

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-26 Thread Diez B. Roggisch
Evan Driscoll schrieb: On Aug 25, 3:47 pm, Evan Driscoll wrote: So here is my simplified version that only works for globals: So I think this works if (1) you only use changed_value in the same module as it's defined in (otherwise it picks up the globals from the module it's defined in, which

Re: PyObject_CallFunction and writable memory

2009-08-26 Thread Diez B. Roggisch
Christopher Nebergall schrieb: I'm working a patch to a hex editor (frhed) written in c++ so it can load python scripts. Internally the c++ code has a unsigned char * of possibly serveral hundred megs which I want to send into the python code to modify.What is the best way to send the unsigne

Re: Python, qt, and lgpl

2009-08-26 Thread Diez B. Roggisch
sturlamolden schrieb: On 25 Aug, 21:45, Terry Reedy wrote: Will be good news if realized. Good news for everyone except Riverbank. And only if LGPL is something you can live with. Some projects require more liberal licenses. Or is there a commercial license available, too? Diez --

Re: ubuntu dist-packages

2009-08-26 Thread Diez B. Roggisch
Robin Becker wrote: > I was surprised a couple of days ago when trying to assist a colleage with > his python setup on a ubuntu 9.04 system. > > We built our c-extensions and manually copied them into place, but > site-packages wasn't there. It seems that ubuntu now wants stuff to go > into lib/p

Re: Object's nesting scope

2009-08-26 Thread Diez B. Roggisch
zaur wrote: > Hi folk! > > What do you think about idea of "object's nesting scope" in python? > > Let's imaging this feature, for example, in this syntax: > > obj=: > > > or > > : > > > That's means that result object of evaluation is used as > nested scope for evaluation. > >

Re: How to exclude "import"s from PyDoc

2009-08-26 Thread Diez B. Roggisch
Matt Bellis schrieb: Hi all, I tried PyDoc today for documentation for a small project on which I'm working. I have a class, foo, in foo.py. However, at the beginning of the file I "from math import *". When I use PyDoc, it's pulling in all the math functions ---snip--- . . . FUNCTION

Re: ubuntu dist-packages

2009-08-27 Thread Diez B. Roggisch
Paul Boddie wrote: > On 26 Aug, 17:48, Jorgen Grahn wrote: >> >> Well, if you are thinking about Debian Linux, it's not as much >> "ripping out" as "splitting into a separate package with a non-obvious >> name". Annoying at times, but hardly an atrocity. > > Indeed. Having seen two packages toda

Re: Algorithms as objects?

2009-08-28 Thread Diez B. Roggisch
output, and which can be put together to get the final results. However, I am not sure how to program this, especially since one cannot subclass function type. To be clear let me give simplified example of what is needed: f(x) has unknown shape, so one would like to try, say f1(x) = ax - b x**2 or

Re: comparison on list yields surprising result

2009-08-28 Thread Diez B. Roggisch
Dr. Phillip M. Feldman schrieb: In [21]: x Out[21]: [1, 2, 3, 5] In [22]: x>6 Out[22]: True Is this a bug? In python2.x, it's the defined behavior - all types are somhow comparable. The comparison is stable (all lists compare larger to all ints), but of course this by no means well-defined.

Re: comparison on list yields surprising result

2009-08-28 Thread Diez B. Roggisch
Dr. Phillip M. Feldman schrieb: In [21]: x Out[21]: [1, 2, 3, 5] In [22]: x>6 Out[22]: True Is this a bug? In python2.x, it's the defined behavior - all types are somhow comparable. The comparison is stable (all lists compare larger to all ints), but of course this by no means well-defined.

Re: Combining C and Python programs

2009-08-29 Thread Diez B. Roggisch
Sortie schrieb: I want to write a program that will use ode for the physics simulation, whose python bindings are outdated. So I'm writing the physics engine in C and want to write the drawing code in Python. What will be the best way of making those two programs work together? THe physics eng

Re: How to install setuptools...egg?

2009-08-30 Thread Diez B . Roggisch
Rolf wrote: > Hi, > > I would like to install setuptools for Python2.6 on Windows. > Unfortunately I could only find setuptools-0.6c9-py2.6.egg but no > *.exe > for Python2.6. And as far as I understand I need setuptools to install > a > Python egg. I would be very appreciative for any help.

Re: initilize a memory zone in python

2009-08-30 Thread Diez B. Roggisch
Mug schrieb: hello, i'm new in python, i used to program in C, i have a small problem, i tryed to do some serial port things manipulation with python. i have something like: import sys,termios fd = sys.stdin.fileno() term_conf=termios.tcgetattr(fd); now i want to modify the actuall values in t

Re: initilize a memory zone in python

2009-08-31 Thread Diez B. Roggisch
Mug schrieb: On Aug 30, 8:58 pm, "Diez B. Roggisch" wrote: Mug schrieb: hello, i'm new in python, i used to program in C, i have a small problem, i tryed to do some serial port things manipulation with python. i have something like: import sys,termios fd = sys.stdin.fil

Re: starting a client remotely

2009-08-31 Thread Diez B. Roggisch
jacopo wrote: > I am playing with multiprocessing and I would like to have a python > script on one machine which initialize my whole system, in other > words, this script should start the server (a python script) on my > local machine and the clients (python scripts) on the other machines > in my

Re: starting a client remotely

2009-08-31 Thread Diez B. Roggisch
jacopo wrote: > thank you Diez, > unfortunatelly I am on Windows NT. > Did you use SSH in a python script? Via subprocess, yes. Paramiko would be a way, too. > Isn't multiprocessing.managers already doing something like Pyro? I never used it, so I don't know - but it appears to be, yes. Doesn't

Re: executable path finding

2009-08-31 Thread Diez B. Roggisch
koranthala wrote: > Hi, > I am creating a python application using py2exe. I am facing a > problem which I am not sure how to solve. > The application contains many other files associated with it - > like icons, config files etc. The executable can be in any directory. > If the user create

Re: website feedback to where?

2009-09-02 Thread Diez B. Roggisch
rogerdpack schrieb: On Sep 2, 12:30 pm, Terry Reedy wrote: rogerdpack wrote: on this page http://docs.python.org/3.1/tutorial/introduction.html some of the "text" examples are [incorrectly] color formatted. I did not see any problems with my browser (FF3.5), so please be more specific. sear

Re: website feedback to where?

2009-09-02 Thread Diez B. Roggisch
MRAB schrieb: Diez B. Roggisch wrote: rogerdpack schrieb: On Sep 2, 12:30 pm, Terry Reedy wrote: rogerdpack wrote: on this page http://docs.python.org/3.1/tutorial/introduction.html some of the "text" examples are [incorrectly] color formatted. I did not see any problems with

Re: Python SSH interface

2009-09-04 Thread Diez B. Roggisch
Mag Gam wrote: > Is there something similar to NetSSH > (http://search.cpan.org/dist/Net-SSH-Perl/) for python? Google dead today? From the > 3.000.000 answers for python + ssh, I suggest paramiko, but there are more options. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: How to download directly to a file?

2009-09-04 Thread Diez B. Roggisch
kj schrieb: I want to send a POST request and have the returned content put directly into a file. Is there a way to do this easily in Python? I've been looking at the documentation for urllib2, but I can't see a direct way to do this, other than saving the returned contents to an in-memory varia

Validation in RPC call?

2009-09-07 Thread Phillip B Oldham
I'm building an RPC service, and I need to validate the input and provide informative error messages to users. What would be the best way to do this? Simple `if` statements each raising a custom exception? `assert` statements inside a try/except block to "translate" the assertion errors into someth

Re: Smallest float different from 0.0?

2009-09-07 Thread Diez B. Roggisch
Paul McGuire wrote: > On Sep 7, 9:47 am, kj wrote: >> Is there some standardized way (e.g. some "official" module of such >> limit constants) to get the smallest positive float that Python >> will regard as distinct from 0.0? >> >> TIA! >> >> kj > > You could find it for yourself: > for i

Re: Modifying a row in a textfile

2009-09-08 Thread Diez B. Roggisch
Olli Virta wrote: > Hi! > > I got a textfile made out of database records. Is there an easy way to > modify rows in that file in case you have to take away some items here > and there from each rows. for line in inf.readlines(): if matches_criteria(line): line = modify_line(line)

Re: [Tkinter] messed callbacks

2009-09-09 Thread Diez B. Roggisch
Giacomo Boffi wrote: > i have this test program (that i already posted on it.comp.lang.python) > > [ test.py ] > from Tkinter import * > > def output(s): > print s > > def doit(fr,lst): > for c1,c2 in zip(lst[::2], lst[1::2]): > subframe=Frame(fr) > Label(subframe,text=c1+' <->

Re: Open Position: Software/System Engineer....Python....

2009-09-09 Thread Diez B. Roggisch
James wrote: > Hello All > I do not know if this is the correct forum. I am looking for a > Software/System Engineer with Python experience in the Cleveland, OH > area. The skill set looks like this: > > Skills/Qualifications: > • Working in a dynamic, self motivated environment with minima

Re: Open Position: Software/System Engineer....Python....

2009-09-09 Thread Diez B. Roggisch
Diez B. Roggisch wrote: > James wrote: > >> Hello All >> I do not know if this is the correct forum. I am looking for a >> Software/System Engineer with Python experience in the Cleveland, OH >> area. The skill set looks like this: >> >> Skills/Qua

Re: Less APIs or more encapsulation?

2009-09-09 Thread Diez B. Roggisch
一首诗 wrote: > 2 class, B contains C. When user want to use some service of C, > there are two choice: > > First, more encapsulation: > > = > class B: > def newMethod(self): > self.c.newMethod() > > class C: >

Re: lxml question

2009-09-10 Thread Diez B. Roggisch
mattia wrote: > I would like to click on an image in a web page that I retrieve using > urllib in order to trigger an event. > Here is the piece of code with the image that I want to click: > onclick="return checkPhoneField(document.contactFrm, 'mobile');" > alt="sms" src="images/button_sms.bmp"

Re: PYTHONPATH issue with sibling package names

2009-09-10 Thread Diez B. Roggisch
Stuart Moffatt wrote: > Environment: Eclipse 3.4.2, Windows XP Pro SP2, Pydev 1.4.4, python > 2.6 > > When I work in eclipse with java, I like to break up my client and > server packages, like this: > > client-project/src/org/me/client > > server-project/src/org/me/api > server-project/src/org/

Re: How to create an array which can be used also as a dictionary

2009-09-10 Thread Diez B. Roggisch
Hans Müller wrote: > Hello, > > I have a lot of items having a name and a given sequence. > > To access these items fast in a sequence order they should be used as > a list, but to be fetched fast by name they also should be in a > dictionary. > > Code could be something like this. > > class i

Re: Download and save a picture - urllib

2009-09-10 Thread Diez B. Roggisch
mattia wrote: > Hi all, in order to download an image. In order to correctly retrieve the > image I need to set the referer and handle cookies. > > opener = urllib.request.build_opener(urllib.request.HTTPRedirectHandler > (), urllib.request.HTTPCookieProcessor()) > urllib.request.install_opener(o

Re: Execution order

2009-09-11 Thread Diez B. Roggisch
DarkBlue wrote: > Here is some code from a pyqt4.5.4 application on python 2.6 > > def findData(self): > > self.ui.label.setText('Processing... ') > > # here we do something which takes a few seconds > self.refreshGrid() > > > > The problem is that the text in the self.ui.

Re: How can I use my modules here?

2009-09-11 Thread Diez B. Roggisch
Chris Rebert wrote: > On Fri, Sep 11, 2009 at 2:24 AM, Kermit Mei wrote: >> Hello community! >> >> I write a modules for testing, and my code is like this(under Linux): >> >> >> $ tree >> . >> |-- MyTestModules >> | |-- Test1.py >> | |-- Test2.py >> | `-- __init__.py >> `-- main.py >> >> 1 direct

Re: Problem with the inclusion of new files like lxml, django, numpy, etc.

2009-09-11 Thread Diez B. Roggisch
joy99 schrieb: Dear Group, I am trying to download the following files, a) lxml, b) numpy, c) scipy, and d) django. I am trying to include them in C\python26\Lib But they are giving error report, as I am trying to use them by importing. What is an "error report"? Unless yo

Re: How to improve this code?

2009-09-14 Thread Diez B. Roggisch
Oltmans schrieb: Hello, Is there someway I can improve the following code(pythonically)? (Copying from IDLE) match=[1,2,3,4,5] def elementsPresent(aList): result=False if not aList: return False for e in aList: if e in match:

Re: Application Packages

2009-09-15 Thread Diez B. Roggisch
Dj Gilcrease schrieb: Say I have an application that lives in /usr/local/myapp it comes with some default plugins that live in /usr/local/myapp/plugins and I allow users to have plugins that would live in ~/myapp/plugins Is there a way to map ~/myapp to a user package so I could do "from user.pl

Re: How do I begin debugging a python memory leak?

2009-09-16 Thread Diez B. Roggisch
Matthew Wilson schrieb: I have a web app based on TurboGears 1.0. In the last few days, as traffic and usage has picked up, I noticed that the app went from using 4% of my total memory all the way up to 50%. I suspect I'm loading data from the database and somehow preventing garbage collection.

Re: Shebang line problems and python

2009-09-17 Thread Diez B. Roggisch
Blaine schrieb: Hello, Scripts that have "#!/usr/bin/python" at the top do not parse correctly. Bash treats scripts with that shebang as if they are bash scripts. E.g.: bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update /usr/sbin/env-update: line 6: import: command not found /usr/sbin/env-update

Re: regex search with a space as the fist character

2009-09-17 Thread Diez B. Roggisch
Daniel Santos schrieb: Hello, print re.compile('u ').search(" u box2", 1) <_sre.SRE_Match object at 0x7ff1d918> print re.compile(' u ').search(" u box2", 1) None Why ? because you start searching at the offset 1, which means you try to find " u " in "u box2" - and that's not found. Di

Re: How to install pysqlite?

2009-09-19 Thread Diez B. Roggisch
Roman Gorbunov schrieb: Hi all, I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following: gunzip pysqlite-2.5.5.tar.gz tar xvf pysqlite-2.5.5.tar cd pysqlite-2.5.5 python setup.py install At the la

Re: python profiling for a XML parser program

2009-09-19 Thread Diez B. Roggisch
MacRules schrieb: I have a python program doing XML data prasing and write the result to 2 data files; which will be loaded to MySQL. I ran this. $ python dealmaker.py ... read data loop through records ... XML parsing ... write to file1.dat ... write to file2.date done Is there a python prof

Re: pyjamas pyv8run converts python to javascript, executes under command-line

2009-09-19 Thread Diez B. Roggisch
Daniel Fetchinson schrieb: the pyjamas project is taking a slightly different approach to achieve this same goal: beat the stuffing out of the pyjamas compiler, rather than hand-write such large sections of code in pure javascript, and double-run regression tests (once as python, second time conv

Re: I look for proxy cache like apt-proxy (for Debian Package) but for python eggs package…

2009-09-20 Thread Diez B. Roggisch
Klein Stéphane schrieb: Hi, I look for a tools to do proxy cache like apt-proxy (for Debian Package) but for python eggs package. Can a easy-install option perform this feature ? No. But you might install EggBasket, which is a PyPI-like server. http://www.chrisarndt.de/projects/eggbasket

Re: Where are python module installed?

2009-09-20 Thread Diez B. Roggisch
Peng Yu schrieb: On Sun, Sep 20, 2009 at 8:37 PM, Daniel Fetchinson wrote: I configured python-2.6.2 with my own --prefix, then 'make' and 'make install'. I only find the following dirs and I don't find any python modules in the directory. Do python modules come with python-2.6.2? $ ls bin in

Re: DBHandler class for logging?

2009-09-22 Thread Diez B. Roggisch
kj schrieb: I've come across mentions of a mythical class of logging handlers called DBHandler, but I can't find it anywhere. Could someone please point me in the right direction? (FWIW, I'm looking for ways to log messages to PostgreSQL RDBMS.) I'm not aware such a thing is part of the stand

Re: DBHandler class for logging?

2009-09-22 Thread Diez B. Roggisch
kj schrieb: In <[email protected]> "Diez B. Roggisch" writes: kj schrieb: I've come across mentions of a mythical class of logging handlers called DBHandler, but I can't find it anywhere. Could someone please point me in the right direction? (FWI

Re: Logging question

2009-09-23 Thread Diez B. Roggisch
Gabor Urban schrieb: Hi guys, I have embarassing problem using the logging module. I would like to encapsulate the creation and setting up of the logger in a class, but it does not seem working. Here are my relevant parts of the code: -- import sys import logging class LogClass: def __in

Re: Very simple finite automaton (?)

2009-09-23 Thread Diez B. Roggisch
kpp9c schrieb: Very simple finite automaton (?) I am not sure if this is and example of Finite Automaton or a Finite State Machine or perhaps it is related to a transition table or markov process. I am not a math person so i am not sure what it is called. I googled around and got lots of super c

Re: Open file on remote linux server

2009-09-23 Thread Diez B. Roggisch
The Bear schrieb: Hi I'm looking to do something like this f = f.openfileobj(remotefileloc, localfilelikeobj) my remote files are on a solaris box that i can access using ssh (could prehap request othe protocols if necessary) anyone got any ideas? try paramiko. Or just use subprocess to scp

Re: What the \xc2\xa0 ?!!

2010-09-07 Thread Diez B. Roggisch
Brian D writes: > In an HTML page that I'm scraping using urllib2, a \xc2\xa0 > bytestring appears. > > The page's charset = utf-8, and the Chrome browser I'm using displays > the characters as a space. > > The page requires authentication: > https://www.nolaready.info/myalertlog.php > > When I

Re: formatted input

2010-09-07 Thread Diez B. Roggisch
Bob writes: > Hi All, > I have another question about formatted input. Suppose I am reading a > text file, and that I want it to be something like this > > word11 = num11, word12 = num12, word13 = num13 etc... > word21 = num21, word22 = num12, word23 = num23 etc... > etc... > > where wordx1 belon

Re: Distribute Non Library

2010-09-12 Thread Diez B. Roggisch
narke writes: > My simple tool writing in python get bigger and bigger and I think I'd > better split my code into several files. But, unlike what in some other > languages, there is no way to compile these several files into a single > executable. Before I splitting my simple tool program, I ju

Re: Distribute Non Library

2010-09-12 Thread Diez B. Roggisch
narke writes: > On 2010-09-12, Glazner wrote: >> On Sep 12, 5:10 am, narke wrote: >>> My simple tool writing in python get bigger and bigger and I think I'd >>> better split my code into several files.  But, unlike what in some other >>> languages, there is no way to compile these several files

Re: help with calling a static method in a private class

2010-09-14 Thread Diez B. Roggisch
lallous writes: > How can I keep the class private and have the following work: > > [code] > class __internal_class(object): > @staticmethod > def meth1(s): > print "meth1:", s > > @staticmethod > def meth2(s): > print "meth2:", > __internal_class.meth1(s)

Re: Accessing windoze file attributes

2010-09-15 Thread Diez B. Roggisch
Douglas writes: > Hi, can anyone direct a relative newbie to the best source of info? > I am writing my own backup app in Python 2.5.2 (all my company will > allow me to use) using IDLE. > I intend to run this app daily via the Task Scheduler to back up a > mission-critical spreadsheet that only

Re: Encoding problem - or bug in couchdb-0.8-py2.7.egg??

2010-09-20 Thread Diez B. Roggisch
> dbName = 'python-tests' > try: > db = server.create(dbName) > except couchdb.PreconditionFailed: > del server[dbName] > db = server.create(dbName) > doc_id, doc_rev = db.save({'type': 'Person', 'name': 'John Doe'}) &g

Re: Python Monitoring

2010-09-20 Thread Diez B. Roggisch
Glazner writes: > Hi, > > I'm will be writing a distributed program with parallel python and i > would like to if there are any good monitoring utilities for python. > I would like each remote server to post messages and to see the > messages in a web-broweser or such. > > I googled python monito

Re: match pattern

2010-09-20 Thread Diez B. Roggisch
rudikk00 writes: > I remember perl has a match function =~/H/ --> which searches if there > is "H" pattern in line. Is there a reasonable analog of it in python? It's called a regular expression, which can be matched or searched in a string. Take a look at the module "re" in python. http://d

Re: Python Monitoring

2010-09-20 Thread Diez B. Roggisch
Glazner writes: > On Sep 20, 6:03 pm, [email protected] (Diez B. Roggisch) wrote: >> Glazner writes: >> > Hi, >> >> > I'm will be writing a distributed program with parallel python and i >> > would like to if there are any good monitoring utilities for

Re: visual studio 2010 question

2010-09-20 Thread Diez B. Roggisch
David Cournapeau writes: > On Mon, Sep 20, 2010 at 3:08 PM, Ralf Haring wrote: >> >> After running into the error "Setup script exited with error: Unable >> to find vcvarsall.bat" when trying to use easy_install / setuptools a >> little digging showed that the MS compiler files in distutils only

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Diez B. Roggisch
Ant writes: > Hi all, > > I've just seen this: http://sheddingbikes.com/posts/1285063820.html > > Whatever you think of Zed Shaw (author of the Mongrel Ruby server and > relatively recent Python convert), he has a very good point in this. I > run Fedora 12 on my home computers, and find it far to

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Diez B. Roggisch
David Cournapeau writes: > On Tue, Sep 21, 2010 at 10:23 PM, Diez B. Roggisch wrote: >> Ant writes: >> >>> Hi all, >>> >>> I've just seen this: http://sheddingbikes.com/posts/1285063820.html >>> >>> Whatever you think of Zed

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Diez B. Roggisch
Antoine Pitrou writes: > On Tue, 21 Sep 2010 17:59:27 +0200 > [email protected] (Diez B. Roggisch) wrote: >> >> The problems explained are simply outdated and crippled python >> versions. >> >> And to me, a python version installed that has not the >&g

Re: creating python daemon ?

2010-09-21 Thread Diez B. Roggisch
vineet daniel writes: > Hi > > I have succesfully created daemon with python script and as next step > I am trying to give input to that python script daemon from Apache > Logshere I have got stuck and I have even checked IRC python > channel for solution. Apache is able to call the file but

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Diez B. Roggisch
David Cournapeau writes: >> >> I don't deny them their experience. Do you deny the experience of other >> people with *other* needs? As I already said: I don't propose to ditch >> the package management. I'm all fine with a distro that carefully >> selects it's packages and dependencies. > > In y

Re: Python in Linux - barrier to Python 3.x

2010-09-21 Thread Diez B. Roggisch
Ned Deily writes: > In article <[email protected]>, [email protected] (Diez B. Roggisch) > wrote: >> The point is that the distro doesn't care about the python eco >> system. Which is what I care about, and a lot of people who want to ship >> software. > &g

Re: creating python daemon ?

2010-09-22 Thread Diez B. Roggisch
vineet daniel writes: > On Sep 21, 9:47 pm, [email protected] (Diez B. Roggisch) wrote: >> vineet daniel writes: >> > Hi >> >> > I have succesfully created daemon with python script and as next step >> > I am trying to give input to that python script daemo

Re: Check whether file is being written to

2010-09-23 Thread Diez B. Roggisch
Thomas Jollans writes: > On Thursday 23 September 2010, it occurred to loial to exclaim: >> How can I check whether a file is being written to by another process >> before I access it? >> >> Platform is unix. > > As such, you can't. But you can lock the file using the functions in the > fcntl

Re: relative imports and sub-module execution

2010-09-28 Thread Diez B. Roggisch
King writes: > Hi, > > After reading couple of docs and articles, I have implemented a simple > test package with nested modules. > When running "main.py", everything is working fine. Some of my sub- > modules has some small test routines for debug purpose. > It's because I am using relative pack

Re: function decorators

2010-09-28 Thread Diez B. Roggisch
Nick Donohue writes: > I came across this code just now: > > def time_me(function): > def wrap(*arg): > start = time.time() > r = function(*arg) > end = time.time() > print "%s (%0.3f ms)" %(function.func_name, (end-start)*1000) > return wrap > > @time_me > def some_function(s

Re: Example or recomendation of a webserver

2010-09-29 Thread Diez B. Roggisch
Hidura writes: > I am working on a web project written on Py3k and using mod_wsgi on > the Apache that have to recibes the request client via a xml structure > and i am facing a lot of troubles with the upload files mainly because > i can' t see where they are, so i' ve decide to write my own web

Re: utf-8 and ctypes

2010-09-30 Thread Diez B. Roggisch
Brendan Miller writes: > 2010/9/29 Lawrence D'Oliveiro : >> In message , Brendan >> Miller wrote: >> >>> It seems that characters not in the ascii subset of UTF-8 are >>> discarded by c_char_p during the conversion ... >> >> Not a chance. >> >>> ... or at least they don't print out when I go to p

Re: will Gnome 3.0 kill pygtk?

2010-09-30 Thread Diez B. Roggisch
Tracubik writes: > Hi! > It seem that the new version of gnome 3.0 will dismiss pygtk support. > > link: > > [1] http://live.gnome.org/TwoPointNinetyone/ (search killing pygtk) > > [2] http://live.gnome.org/GnomeGoals/PythonIntrospectionPorting > > > i'm studying pygtk right now, am i wasting

Re: Problems with wsgi Python3

2010-09-30 Thread Diez B. Roggisch
[email protected] writes: > Hello list, i had seriously troubles with the connection between a form and > the > wsgi, i' ve made an application on Python3 and was running perfectly but when > i > try to use the to pass the data this can't be see on the server, so > what > is your recommendation

Re: Problems with wsgi Python3

2010-09-30 Thread Diez B. Roggisch
_chunked': >> > [Thu Sep 30 13:35:07 2010] [error] '0', >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listener_host': >> > [Thu Sep 30 13:35:07 2010] [error] '', >> > [Thu Sep 30 13:35:07 2010] [error] 'mod_wsgi.listene

Re: ElementTree handling nested tag

2010-10-02 Thread Diez B. Roggisch
tekion writes: > All, > I have the following xml tag: > > > httpRequest > HTTP://cmd.wma.ibm.com:80/ > GET > 200 > > > > I am interested in: >httpRequest > HTTP://cmd.wma.ibm.com:80/ > GET > 200 > as well as the upper layer tag. How do I ge

Re: Problem saving uploaded files in Python3

2010-10-02 Thread Diez B. Roggisch
ta)[1:].strip("' '")#Here the data from the >> environ['wsgi.input'], first i convert the byte into a string delete the >> first field that represent the b and after i strip the single quotes >> dat = tmpData.split('\\r')#Then i split all t

Re: Unclear datetime.date type when using isinstance

2010-10-02 Thread Diez B. Roggisch
"Mailing List" writes: > Was including a input check on a function argument which is expecting a > datetime.date. When running unittest no exception was raised when a > datetime.datetime instance was used as argument. Some playing with the > console lead to this: > import datetime > dt1

Re: ElementTree handling nested tag

2010-10-03 Thread Diez B. Roggisch
tekion writes: > On Oct 2, 5:32 am, [email protected] (Diez B. Roggisch) wrote: >> tekion writes: >> > All, >> > I have the following xml tag: >> > >> > >> >       httpRequest >> >       HTTP://cmd.wma.ibm.com:80/ >>

Re: ElementTree handling nested tag

2010-10-04 Thread Diez B. Roggisch
tekion writes: > On Oct 3, 2:09 pm, [email protected] (Diez B. Roggisch) wrote: >> tekion writes: >> > On Oct 2, 5:32 am, [email protected] (Diez B. Roggisch) wrote: >> >> tekion writes: >> >> > All, >> >> > I have the following xml tag: &g

Re: Is there a Python Version Manager?

2010-10-04 Thread Diez B. Roggisch
TerryP writes: > On Oct 4, 4:12 am, Kushal Kumaran > wrote: >> Is virtualenv what you need? >> >> http://pypi.python.org/pypi/virtualenv >> >> > >> >> -- >> regards, >> kushal > > > Not quite. It basically amounts to a UNIX version of xcopy'ing an > existing Python installation. > > ... insta

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-04 Thread Diez B. Roggisch
TheOne writes: > Hi. > > I installed eclipse/pydev today. > I created a pydev project and added python source files with utf-8 > BOM. > Eclipse/Pydev reports lexical error : > Lexical error at line 1, column 1. Encountered: "\ufeff" (65279), > after : "" > > I want the source files to have BOM

Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

2010-10-04 Thread Diez B. Roggisch
Pascal Polleunus writes: > Hi, > > I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04. > > > My problem is also explained on stackoverflow: > http://stackoverflow.com/questions/3847536/installing-psycopg2-in-virtualenv-ubuntu-10-04-python-2-5 > > > I tried different things explaine

Re: Deditor:Pythonic text editor

2010-10-04 Thread Diez B. Roggisch
Kruptein writes: > Hey, I released the 0.2.1 version of my text-editor written for linux > in python using the wxPython toolkit. > > I would like to know whether it is good/bad and what could be changed/ > added > > this version added > -syntax-highlighting for 78 languages > -Tab completion in

Help with sets

2010-10-04 Thread B. M. Whealton
below, what is being yielded, the key or the value in the dictionary? I refer to this for loop here: for subject in self._pos[predicate][ojbect]: yield (subject, predicate, object) Thanks for any help and insights into this, Bruce -- ++++

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
Lawrence D'Oliveiro writes: > In message > , TheOne > wrote: > >> I want the source files to have BOM character. > > What exactly is the point of a BOM in a UTF-8-encoded file? It's a MS-specific thing that makes a file identifieable as UTF-8-encoded under windows. The name BOM is obviously BS,

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
TheOne writes: > On Oct 4, 9:26 pm, [email protected] (Diez B. Roggisch) wrote: >> TheOne writes: >> > Hi. >> >> > I installed eclipse/pydev today. >> > I created a pydev project and added python source files with utf-8 >> > BOM. >> > E

Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

2010-10-05 Thread Diez B. Roggisch
Pascal Polleunus writes: > On 05/10/10 00:11, Diez B. Roggisch wrote: >> Pascal Polleunus writes: >> >>> Hi, >>> >>> I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04. >>> >>> >>> My problem is also

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-05 Thread Diez B. Roggisch
Lawrence D'Oliveiro writes: > In message > <2752e2e4-76fe-475a-a476-e5458bbfd...@z30g2000prg.googlegroups.com>, TheOne > wrote: > >> Anyway, it would be great if I could make my eclipse/pydev to >> understand the BOM character and suppress the lexical error msg. > > What exactly is the point of

Re: direct print to log file

2010-10-05 Thread Diez B. Roggisch
Dirk Nachbar writes: > How can I direct all print to a log file, eg some functions have their > own print and I cannot put a f.write() in front of it. you can replace sys.stdout with something that performs logging. class MyWriter(object): def __init__(self, old_stream): self.o

Re: subclass constructor problem

2010-10-05 Thread Diez B. Roggisch
Nikola Skoric writes: > I have a superclass Element and a subclass Family. All Family.__init__() does > is run Element.__init__() and self.__parse(). For some reason it seems like > self.__parse() isn't run. Here is the code: > http://github.com/dijxtra/simplepyged/blob/8d5a6d59268f6760352783cc

Re: help!!!

2010-10-06 Thread Diez B. Roggisch
writes: > plz can u convert this cpp file into python i need that badly as soon as > possible... I am new to python. I just wanna learn it For such an aspiring student of the art of computer programming, I have the strange feeling of lack-of-effort-showing here. Do I have to lose my faith i

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Diez B. Roggisch
Seebs writes: > On 2010-10-06, geekbuntu wrote: >> in general, what are things i would want to 'watch for/guard against' >> in a file upload situation? > > This question has virtually nothing to do with Python, which means you > may not get very good answers. In contrast to "comp.super.web.expe

Re: hashkey/digest for a complex object

2010-10-06 Thread Diez B. Roggisch
> leaf elements, which are frozensets of strings. The keys at every > level of this structure are strings. E.g. a simple example of such > an attribute would look like: > > {'A': {'a': set(['1', '2', '3']), >'b': s

Re: list parameter of a recursive function

2010-10-06 Thread Diez B. Roggisch
TP writes: > Hi, > > I have a function f that calls itself recursively. It has a list as second > argument, with default argument equal to None (and not [], as indicated at: > http://www.ferg.org/projects/python_gotchas.html#contents_item_6 ) > > This is the outline of my function: > > def f ( a

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Diez B. Roggisch
Seebs writes: > On 2010-10-06, Diez B. Roggisch wrote: >> Seebs writes: >>> On 2010-10-06, geekbuntu wrote: >>>> in general, what are things i would want to 'watch for/guard against' >>>> in a file upload situation? > >>> This q

Re: suggestions please "what should i watch for/guard against' in a file upload situation?"

2010-10-06 Thread Diez B. Roggisch
Martin Gregorie writes: > On Wed, 06 Oct 2010 09:02:21 -0700, geekbuntu wrote: > >> in general, what are things i would want to 'watch for/guard against' in >> a file upload situation? >> >> i have my file upload working (in the self-made framework @ work without >> any concession for multipart

Re: help!!!

2010-10-06 Thread Diez B. Roggisch
Seebs writes: > On 2010-10-06, Diez B. Roggisch wrote: >> writes: >>> plz can u convert this cpp file into python i need that badly as soon as >>> possible... I am new to python. I just wanna learn it > >> For such an aspiring student of the art of

<    39   40   41   42   43   44   45   >