[ANN] pysqlite 2.4.0 released

2007-11-25 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 pysqlite 2.4.0 released === I'm pleased to announce the availability of pysqlite 2.4.0. This is a release with major new features. Go to http://pysqlite.org/ for downloads, online documentation and reporting bugs. What is pysqlit

Re: blob problems in pysqlite

2006-04-26 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > Hi there. > > I'm a long-time lurker and (I think) first time poster. > Only relatively new to python, and I'm trying to get pysqlite to work > with binary data, and having a tough time of it. [...] It seems to me that you're using pysqlite correctly. Where exactly is

Re: blob problems in pysqlite

2006-04-27 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Excellent. Got that working. Now, how to get the pickled data out of the database? I'm trying to use cPickle.loads(data) (code attached), and I get a: "TypeError: loads() argument 1 must be string, not list" [...] [...] c.execute("select Images from FileURLInfo where URL

Re: MinGW and Python

2006-04-27 Thread Gerhard Häring
sturlamolden wrote: > [...] The problem is actually *licensing issues* related to CYGWIN1.DLL. It > cannot always be linked. CYGWIN1.DLL can only be used for Open Source > development. [...] Of course Redhat offers an alternative license that does not have the GPL restrictions: http://www.redhat.

Re: MS VC++ Toolkit 2003, where?

2006-04-28 Thread Gerhard Häring
Brian Elmegaard wrote: > "sturlamolden" <[EMAIL PROTECTED]> writes: > >> I believe MinGW can link .lib C libraries files from Visual Studio. But >> there are no .a for Python24.dll as far as I can tell. > > But afaik you don't need one. Actually, a libpython24.a file was added in Python 2.4.1. T

Re: Recommendations for a PostgreSQL db adapter, please?

2006-04-29 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Keen Anthony wrote: > Hello, > > I am currently using psycopg 2 as my db adapter for a mod_python & > PostgreSQL web app. It's works fine, and I haven't any complaints. I > would appreciate some input on what other pythonistas like in an > adapter.

Re: Recommendations for a PostgreSQL db adapter, please?

2006-04-29 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim Churches wrote: > Gerhard Häring wrote: >>[...] Considering pyPgSQL, psycopg1, PyGreSQL and psycopg2 - psycopg2 is a >>good >>choice. > > Hmmm, Gerhard, you are listed as one of two developers for pyPgS

Re: python strings

2006-05-03 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > Is it possible for python strings to contain a zero byte? Yes. Here's how to produce one: [EMAIL PROTECTED]:~$ python Python 2.4.2 (#2, Sep 30 2005, 21:19:01) [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on lin

Re: Python sample code for PLSQL REF CURSORS

2006-05-04 Thread Gerhard Häring
A.M wrote: > Hi, > > I am having hard time to find a sample that shows me how to return an OUT > REF CURSOR from my oracle stored procedure to my python program. [...] import cx_Oracle con = cx_Oracle.connect("me/[EMAIL PROTECTED]") cur = con.cursor() outcur = con.cursor() cur.execute("""

Re: Python sqlite and regex.

2006-05-19 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Matt Good wrote: > SQLite3 already has a REGEXP function, so you don't need to create your > own. [...] Yes, but SQLite does not include a regular expression engine, and thus according to the SQLite docs you need to register a REGEXP function in order

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ > foo/bar'. I get the original dirpath from tkFileDialog.askdirectory in > a Windows form and none of os.path.* functions seem to resolve it to a > cygwin form. Rather they _append_ it to the current d

Re: Pysqlite issue no attribute 'autocommit'

2008-02-05 Thread Gerhard Häring
Paul McNett wrote: > Andy Smith wrote: > >> Im trying to run a Python based program which uses MySQL with >> python-sqlite and Im recieving this error, >> >> 'Connection' object has no attribute 'autocommit' [...] No, why should it have one? It's not documented to have one. To do what you i

Re: win32com.client question

2008-02-13 Thread Gerhard Häring
Juan_Pablo wrote: > import win32com.client > is posible in linux ? Not in any meaningful way. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Why this ref leak?

2008-02-27 Thread Gerhard Häring
import sys def foo(): class C(object): pass foo() print ">>", sys.gettotalrefcount() foo() print ">>", sys.gettotalrefcount() foo() print ">>", sys.gettotalrefcount() >> 21366 >> 21387 >> 21408 [9779 refs] Both Python 2.4 and 2.5 don't clean up properly here. Why is this? Aren

[ANN] pysqlite and APSW projects moved

2008-03-09 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dear pysqlite users! I've moved both the pysqlite and APSW project to new homes. pysqlite web:http://oss.itsystementwicklung.de/trac/pysqlite aka http://pysqlite.org/ scm:pysqlite now uses a Mercurial repository http://oss.i

Re: [pysqlite] [ANN] pysqlite and APSW projects moved

2008-03-09 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gerhard Häring wrote: > [...] APSW > > > web:http://oss.itsystementwicklung.de/trac/apsw/ > scm:Subversion: http://initd.org/svn/pysqlite/apsw/trunk/ That should have been http://oss.itsystementwicklung.de/svn/apsw/apsw

Re: agg (effbot)

2008-03-12 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > Downloaded to Knoppix 5.1: > : > aggdraw-1.2a3-20060212.tar.gz > > Followed README. Wouldn't compile. [...] Try shegabittling the frotz first. If that doesn't help, please post the output of the compile command that threw the error. -- Gerhard -- http://mail.python.

Re: [pysqlite] [ANN] pysqlite and APSW projects moved

2008-03-13 Thread Gerhard Häring
Colin Mcphail wrote: > On 2008-03-09 18:57:00 +0000, Gerhard Häring <[EMAIL PROTECTED]> said: > > Gerhard Häring wrote: >>>> [...] APSW >>>> >>>> >>>> web:http://oss.itsystementwicklung.de/trac/apsw/ >>>> scm:

Re: How to solve a three-element equation set?

2008-03-19 Thread Gerhard Häring
purple wrote: > Could you guys do me a favor for solving a equation set? > > Z=d/4*(1-SIN(X)/X) > X=8q/(D^2*Y)+SIN(X) > Y=1/n*Z^(2/3)*i^(1/2) > > In this equation set, X,Y&Z are the unkown parameters, the others say, > d, q, n&i are known. SO in python, how to program it to represent X, Y > and Z

Re: What Programming Languages Should You Learn Next?

2008-03-19 Thread Gerhard Häring
wesley chun wrote: > http://it.slashdot.org/it/08/03/18/1633229.shtml > > it was surprising and disappointing that Python was not mentioned > *anywhere* in that article [...] Probably because Ruby is all hot and sexy nowadays ;-) Though it's remarkably close to Python, apparently. So close that

Re: Python 2.5 - Build Error on Windows because of SQLite3

2008-03-28 Thread Gerhard Häring
llothar wrote: > Why does Python2.5 do not include the amalgamation source code of > sqlite3? [...] First, at the time Python grew the sqlite3 module, there was no amalgamation yet. My reasoning: So that Python doesn't need to release a security release, should a security bug in SQLite be found.

Re: PyQt4 on Windows ?

2009-01-20 Thread Gerhard Häring
Linuxguy123 wrote: What does it take to get a PyQt4 application running on a Windows machine ? To run, installing Python + PyQt4 ;-) To create a binary wrapper, I use py2exe (I also tried cx_Freeze, both work the same). There's a gotcha with PyQt4 - snippet follows: setup( options = {"p

Re: Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code?

2009-01-24 Thread Gerhard Häring
Casey Hawthorne wrote: Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code? I suppose I'm thinking of an extra layer of indirection, which might slow things down to much. Aren't this just Python libraries that i

Re: updating nntplib

2009-02-06 Thread Gerhard Häring
Travis wrote: > Hello all, > > There are some notable deficiencies in nntlib. Here are two: [...] Be sure to add a bug report/patch to the Python bug tracker. http://bugs.python.org/ Anything else will most likely be overlooked or forgotten. -- Gerhard -- http://mail.python.org/mailman/listi

Re: Local python web server problem

2009-02-09 Thread Gerhard Häring
Farsheed Ashouri wrote: > Hi everyone. I have started to develop a web base software for > renderfarm managing. > I run the cherrypy hello world! example and when I visit > 127.0.0.1:8080 > on firefox, a nice "Hello World" appears. I am on ubuntu and my ip in > local network is 192.168.100.18 > but

Re: Which core am I running on?

2009-02-09 Thread Gerhard Häring
psaff...@googlemail.com wrote: > Is there some way I can get at this information at run-time? I'd like > to use it to tag diagnostic output dumped during runs using Parallel > Python. Looks like I have answered a similar question once, btw. ;-) http://objectmix.com/python/631346-parallel-python.h

Re: Which core am I running on?

2009-02-09 Thread Gerhard Häring
psaff...@googlemail.com wrote: > Is there some way I can get at this information at run-time? I'd like > to use it to tag diagnostic output dumped during runs using Parallel > Python. There should be a way, but not with the Python standard library. It's also platform-specific. What are you using?

Re: Which core am I running on?

2009-02-10 Thread Gerhard Häring
psaff...@googlemail.com wrote: > On 9 Feb, 12:24, Gerhard Häring wrote: >> http://objectmix.com/python/631346-parallel-python.html >> > > Hmm. In fact, this doesn't seem to work for pp. When I run the code > below, it says everything is running on the one core. &

Re: Display a list using PyQt

2009-02-16 Thread Gerhard Häring
member Basu wrote: > I'm writing an application with PyQt as the GUI toolkit. I have a > function that returns a simple list and I would like to update a List > View widget with it. However I can't get it to work. I'm not sure if I > need to subclass one of the Model classes, because it is just a l

Re: python an sqlite objects

2008-12-03 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > azrael> is it possible to save a python object into a sqlite database as > azrael> an atribute of type BLOB > > Sure. Just pickle the object and save the resulting string. Be sure to save it as BLOB, not TEXT. Suppose you have serialized your object as Python

Re: python an sqlite objects

2008-12-03 Thread Gerhard Häring
azrael wrote: It logical that it would be more efficient and logical to use a object oriented database, but in this case I ask because of the portable nature of sqlite. so, if I get it right, this should be possible [...] Did you try it? Did it work? If so,it was pure luck. Attached is a scri

Re: building an extension module with autotools?

2008-12-03 Thread Gerhard Häring
Michael George wrote: Hello, (Please CC me in replies, as I am off-list) Ok, but please reply publicly. I'm building an application (a game) in python, with a single C module containing some performance-critical code. I'm trying to figure out the best way to set it up to build. Use dist

Re: Pythonic design patterns

2008-12-04 Thread Gerhard Häring
Slaunger wrote: > Hi comp.lang.python > > I am this novice Python programmer, who is not educated as a computer > scientist (I am a physicist), and who (regrettably) has never read the > GOF on design patterns. [...] > I guess I could boost my productivity by learning these well-proven > and well

Re: RELEASED Python 3.0 final

2008-12-04 Thread Gerhard Häring
Iain King wrote: > [...] Props. I just looked through the What's New and the change log, but I > couldn't find the answer to something: has any change been made to > how tabs and spaces are used as indentation? Can they still be > (inadvisably) mixed in one file? Or, more extremely, has one or

Re: turtle ?

2008-12-23 Thread Gerhard Häring
sai wrote: > python newbie here :-) > > I am trying to get turtle to run but got stuck here: > > $ python > Python 2.5.2 (r252:60911, Aug 5 2008, 16:17:28) > [GCC 4.2.2 20071128 (prerelease) (4.2.2-3.1mdv2008.0)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.

Re: SQL, lite lite lite

2008-12-30 Thread Gerhard Häring
Bruno Desthuilliers wrote: Aaron Brady a écrit : Hi all, (snip) > I don't think relational data can be read and written very easily in Python. Did you try SQLAlchemy or Django's ORM ? [...] Using an ORM when you don't grasp the relational model and/or the SQL query language is futile.

Re: Easy-to-use Python GUI

2008-12-31 Thread Gerhard Häring
Dotan Cohen wrote: I have been following this thread with interest. Is there a way to build Qt apps with relative easy? I use KDE and would prefer the Qt toolkit for my GUI apps. Thanks. A few years ago, I've had bad experiences with wxPython (random things not actually working on Linux, only

Re: Is there a better algorithm?

2009-01-02 Thread Gerhard Häring
Kottiyath wrote: I have the following list of tuples: L = [(1, 2), (3, 4, 5), (6, 7)] I want to loop through the list and extract the values. The only algorithm I could think of is: [...] If this is part of a real program, instead of an exercise, you should fix the code that creates this list

Re: pg_result_status() alternative?

2009-01-07 Thread Gerhard Häring
Qian Xu wrote: Steve Holden wrote: Without knowing the full details of that particular module I would hazard a guess that any database errors will raise exceptions in Python. No exceptions means your database operation worked fine. result status is not an exception. It means the information of

Re: Python Apache Handler

2009-01-09 Thread Gerhard Häring
Scooter wrote: > Does anyone have any good examples, or links thereto for using python > as an Apache handler? And I should qualify all of this by saying I'm a > python newbie, and while having experience with Apache, I've never > done anything outside whats "in the box" . > > What I'm looking for

Re: Encrypted Logging in python

2009-01-09 Thread Gerhard Häring
koranth...@gmail.com wrote: >I was wondering if there is a mechanism to encrypt logging > automatically in python. Python's standard library doesn't include any "strong" symmetric ciphers. But if you include for example a cryptographic module for AES, for example, it should be easy (I guess 10

Re: Pure Python interface to MySQL?

2008-10-07 Thread Gerhard Häring
Gerhard Häring wrote: James Mills wrote: On Tue, Oct 7, 2008 at 9:15 AM, Roy Smith <[EMAIL PROTECTED]> wrote: Does there exist a pure Python version of a MySQL module? I've got a data logging application that needs to run on a whole bunch of OSs, ranging from Windows to a doze

Re: Pure Python interface to MySQL?

2008-10-07 Thread Gerhard Häring
James Mills wrote: On Tue, Oct 7, 2008 at 9:15 AM, Roy Smith <[EMAIL PROTECTED]> wrote: Does there exist a pure Python version of a MySQL module? I've got a data logging application that needs to run on a whole bunch of OSs, ranging from Windows to a dozen different unix flavors on all sorts of

Re: Race condition when generating .pyc files

2008-10-07 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: I have a large body of Python code which runs on many different (Unix) machines concurrently. Part of the code lives in one place, but most of it lives in directories which I find at runtime. I only have one copy of each Python source file and I think I'm hitting a race

Re: like using python

2008-10-16 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: as the subject me2 -- http://mail.python.org/mailman/listinfo/python-list

Re: [APSW] SELECT COUNT(*) not succesfull?

2008-10-23 Thread Gerhard Häring
Dennis Lee Bieber wrote: On Thu, 23 Oct 2008 09:26:54 +0200, Gilles Ganault <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: Yes, but it doesn't work with this wrapper (APSW version 3.5.9-r1): APSW is not, so far as I recall, a "DB-API 2" adapter -- it is a touch more

Re: [APSW] SELECT COUNT(*) not succesfull?

2008-10-23 Thread Gerhard Häring
Gilles Ganault wrote: On Thu, 23 Oct 2008 00:24:01 -0200, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: In case you didn't notice, B.D. already provided the answer you're after - reread his 3rd paragraph from the end. Yes, but it doesn't work with this wrapper (APSW version 3.5.9-r1): The

Re: look-behind fixed width issue (package re)

2008-10-24 Thread Gerhard Häring
MRAB wrote: On Oct 24, 6:29 am, Peng Yu <[EMAIL PROTECTED]> wrote: Hi, It seem that the current python requires fixed-width pattern for look- behind. I'm wondering if there is any newly development which make variable-width pattern available for look-behind. The re module is currently being w

Re: conversion to and from unicode strings

2008-10-27 Thread Gerhard Häring
abhishek wrote: hello group, i want to represent and store a string u'\x00\x07\xa7' as '\x00\x07\xa7'. any ideas on how to achieve this. You want to store it in the form of the repr() of the string? It is possible to use repr() to get a bytestring to store and to use eval() to create a unic

Re: [newbie] Right way to access item in array?

2008-10-28 Thread Gerhard Häring
Diez B. Roggisch wrote: Gilles Ganault wrote: Hello I'd like to know what the right way is to access an item in a row as returned by a database: = import apsw connection=apsw.Connection("test.sqlite") cursor=connection.cursor() rows=cursor.execute("SELECT isbn,price FROM books WHERE pri

Re: Python 2.5 + sqlite full text search possible?

2008-10-28 Thread Gerhard Häring
Guillermo wrote: Hi! Is it possible to load the full-text search module for the SQLite version bundled with Python 2.5? [...] I'm on Windows XP. Yes, it's possible. But not easily. You have to replace the sqlite3.dll that comes with Python 2.5 with one that includes fulltext search. If you

Re: Python 2.5 + sqlite full text search possible?

2008-10-28 Thread Gerhard Häring
Guillermo wrote: Hi! Is it possible to use the full-text module of SQLite with the sqlite3 module? I've done a bit of investigation and it seems the stand-alone distribution of SQLite is compiled without it, Yes, though compiling using the amalgamation and defining SQLITE_ENABLE_FTS3 helps.

Re: list versions of all installed modules

2008-10-28 Thread Gerhard Häring
John [H2O] wrote: Is there a quick way to list the version of each installed module? $ sudo easy_install yolk $ yolk -l -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: Is psyco available for python 2.6?

2008-10-30 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: sert: I used the windows installer for the latest version of psyco, which is labeled as compatible with 2.5, but it gives the following error: ImportError: DLL load failed: The specified module could not be found. (check that the compiled extension 'C:\Python26\lib\site-

Re: PySqlite - division of real numbers without decimal fractions

2008-11-07 Thread Gerhard Häring
Astley Le Jasper wrote: I've been getting errors recently when using pysqlite. I've declared the table columns as real numbers to 2 decimal places (I'm dealing with money), MySQL doesn't have any MONEY type. All it has is INTEGER, REAL, TEXT, BLOB and NULL types. but when doing division on

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Steve Holden wrote: [...] I feel with you. The fact that cursors, and not connection objects have the executeXXX methods is totally braindead. So you'd rather have to use separate connections? That would make isloated transaction processing a little tricky ... No, I just find code like: con

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Charles V. wrote: Hi, Thank for replying. Either use a second cursor OR ensure you fetch all the data from the first .execute() first: Are these really the only solutions ? Yes. I was expecting the same behavior than MySQLdb module, which is, as sqlite3, DB-API 2.0 compatible. Both ma

Re: pysqlite install error on hp ux (ld: Can't find library for -lpython2.5)

2008-11-12 Thread Gerhard Häring
Geon. wrote: hi everyone! when i install pysqlite i meet bellow error. ( use easy_install and source code building same problem ) ld: Can't find library for -lpython2.5 what mean this message? and what i do? my system is hp-ux 11i v3. and python2.5 is installed. ld command also avaliable. I

Re: Problem with sqlite3 cursor and imbricated for loop

2008-11-12 Thread Gerhard Häring
Charles V. wrote: Hi, Both may be standard compliant, but if you're depending on implementation details, you may still get different behaviour. I'm pretty sure that MySQLdb always fetches the entire resultset from the server. The sqlite3 module uses what would have been called "server-side curs

[ANN] pysqlite 2.5.2

2009-03-03 Thread Gerhard Häring
pysqlite 2.5.2 released === Release focus: minor bugfixes, minor new features. pysqlite is a DB-API 2.0-compliant database interface for SQLite. SQLite is a in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.

Re: PyPy Progress (and Psyco)

2009-03-15 Thread Gerhard Häring
andrew cooke wrote: This looks very promising - http://www.voidspace.org.uk/python/weblog/arch_d7_2009_03_14.shtml#e1063 I am really looking forwards to PyPy having a final release. I hope it happens. Me too. I doubt it, though. From an outside view, the project seems to lack focus. To me, i

Re: Best Compatible JS Lib for Django

2009-04-05 Thread Gerhard Häring
Daniel Fetchinson wrote: >> Does anyone have experience with using JS Libraries with Django? >> Do some work better than others and are easier to code with? > > You might want to ask this on the django list. Or on a JavaScript list ;-) It doesn't matter much in what context you use the JavaScript

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-05 Thread Gerhard Häring
John Machin wrote: > On Apr 4, 3:21 pm, John Doe wrote: >> Anybody have a solution for Windows (XP) Explorer search not finding >> ordinary text in *.py files? >> > > Get a grep on yourself! > > http://gnuwin32.sourceforge.net/packages/grep.htm There's something even better: "ack -- better tha

Re: HTTP Authentication

2009-04-06 Thread Gerhard Häring
Lakshman wrote: > Whats is the python urllib2 equivallent of > > curl -u username:password status="abcd" http://example.com/update.json > > I did this: > > handle = urllib2.Request(url) > authheader = "Basic %s" % base64.encodestring('%s:%s' % (username, > password)) > handle.add_header("Author

Re: group several methods under a attribute

2009-04-06 Thread Gerhard Häring
jelle wrote: > Hi, > > I'm working on a pretty large class Can you describe what its purpose is? > and I'd like to group several methods under a attribute. That doesn't work in Python without bending the Python. > Its not convenient to chop up the class in several smaller classes, But that's

Re: C API String Parsing/Returning

2009-04-06 Thread Gerhard Häring
k3xji wrote: > Hi all, > > This might be a newbie question. I am trying to implement a simple > string decoder/encoder algorithm. Just suppose I am substrcating some > values from the string passed as a parameter to the function and I > want the function to return encoded/decoded version of the st

Re: [ANN] Falcon - powering innovation

2009-04-13 Thread Gerhard Häring
Kless wrote: > If anybody is interesed in new technologies, you'll love this new > language called Falcon [1], which has been open sourced ago little > time. > > Falcon is a scripting engine ready to empower mission-critical > multithreaded applications. "Mission-critical" and "empower" sound li

WHIFF - was: Re: Using Python after a few years of Ruby

2009-04-15 Thread Gerhard Häring
Aaron Watters wrote: > On Apr 15, 3:49 am, Tim Hoffman wrote: > >> There are plenty of python web frameworks, some have quite different >> approaches, >> what suits you will depend very much on your own bias, interest. > > I've had a lot of luck with WHIFF > ( http://whiff.sourceforge.net ) > Of

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Gerhard Häring
Peter Otten wrote: > bdb112 wrote: > >> Your explanation of Boolean ops on lists was clear. >> It leads to some intriguing results: >> >> bool([False]) >> --> True >> >> I wonder if python 3 changes any of this? > > No. Tests like > > if items: >... > > to verify that items is a non-empty l

Re: when can i expect libraries and third party tools to be updated for python 3 ?

2009-04-20 Thread Gerhard Häring
Deep_Feelings wrote: > every one is telling "dont go with python 3 , 3rd party tools and > libraries have no compitability with python 3" > > so from previous experience : when can i expect libraries and third > party tools to be updated for python 3 ? (especially libraries ) The problem is: ther

Re: and [True,True] --> [True, True]?????

2009-04-20 Thread Gerhard Häring
Martin v. Löwis wrote: >> Are they widespread? I haven't noticed, yet. >> >> I prefer to write it explicitly: >> >> if len(lst) > 0: > > I prefer to test explicitly for the truth value of the > list. I don't want to test whether the length of the list > is greater than 0 (in fact, I don't care abo

Re: Memory problems (garbage collection)

2009-04-23 Thread Gerhard Häring
Carbon Man wrote: > Very new to Python, running 2.5 on windows. > I am processing an XML file (7.2MB). Using the standard library I am > recursively processing each node and parsing it. The branches don't go > particularly deep. What is happening is that the program is running really > really sl

Re: Memory problems (garbage collection)

2009-04-23 Thread Gerhard Häring
Here's a link for you: http://wiki.python.org/moin/PythonSpeed/PerformanceTips which also talks about string concatenation and othere do's and don'ts. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: value error

2009-04-23 Thread Gerhard Häring
Francesco Pietra wrote: > hi: > with script > > data = open('134-176_rectified_edited.pdb', 'r') > outp = open('134-176_renumbered.pdb', 'w') > > for L in data: >if L[3] == 'M': > L = L[:24] + "%4d" % (int(L[24-28])+133) + L[28:] >outp.write(L) > > > i wanted to modify lines of the

Re: Web framework for embedded system

2009-04-28 Thread Gerhard Häring
Thomas Heller wrote: > I'm looking for a lightweight web-framework for an embedded system. > The system is running a realtime linux-variant on a 200 MHz ARM > processor, Python reports a performance of around 500 pystones. > > The web application will not be too fancy, no databases involved > for

Re: configuring python with disable-thread in Ubuntu

2009-05-07 Thread Gerhard Häring
Deepak Chandran wrote: > Hello, > > I am embedding python inside a C++ program. For some reason (I think > libxml2), I am getting Segmentation fault at PyThread_release_lock. > > The solution I found online was to configure python with --disable-thread. That doesn't sound like a solution, but

Re: update python version

2009-05-07 Thread Gerhard Häring
km wrote: > Hi all, > > Is there a way to update python 2.6.1 to 2.6.2 using easy_install ? No, easy_install installs Python packages. It doesn't upgrade Python itself. If this is Windows, just install the newer Python version. No need to uninstall the 2.6.1 first. If this is some Unix variant,

Re: Learning C++ for Python Development

2009-05-11 Thread Gerhard Häring
joshua.pea...@gmail.com wrote: > I am a recovering C# web developer who has recently picked up Django > and I'm loving it. > > I would eventually like to get a job as a Django/Python developer. It > seems that many Python jobs require that you also be a C++ developer. I've seen the C++/Python com

Re: command prompt: the ntvdm cpu has encountered an illegal instruction

2009-05-24 Thread Gerhard Häring
Daniel wrote: > If I try to invoke python via the command prompt I get an error > "command prompt: the ntvdm cpu has encountered an illegal > instruction..." > > I don't get this problem if I first cd to the python directory. I am > running python 3.0 on windows. Running Python from the Cygwin s

Re: UTC datetime.fromtimestamp

2008-06-03 Thread Gerhard Häring
Alok Kumar wrote: Dear All, I have UTC datetime as datetime.fromtimestamp(ParseDateTimeUTC("2007-12-06 20:37:05")) Just datetime.timedelta(days=1). -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: Please solve me the problem

2008-06-03 Thread Gerhard Häring
sagar panda wrote: Hi I am sagar. I want to write a python script that will run the python scripts automatically from a directory. Please help me out to sovle this problem? You can use the execfile() builtin function to execute Python scripts. And you can use glob.glob("/some/path/*.py") to

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Hello. I am trying to extend my Python program with some C code. [...] Anyway, my question is this: When compiling my C code to include in Python, using a Python script with the function distutils.core.setup... can I choose which C compiler to use? On my system it

Re: How to kill a thread?

2008-06-06 Thread Gerhard Häring
John Dohn wrote: Hi there, How can I kill a threading.Thread subclass from MainThread? My threads are waiting for data in Queue.get() method: class MyThread(threading.Thread): def run(self): while True: data = queue.get()# <- here it waits most of the time

Re: SQlite none english char

2008-06-08 Thread Gerhard Häring
Gandalf wrote: > I works with python 2.5 on windows, And I use sqlite3 > > Now, I have problem searching string in Hebrew in my database > > I have table called "test" with field num and test > firs row i insert "1" and "עברית" (that is "Hebrew" in Hebrew) > second row i insert "2" and "Englis

Re: SQlite none english char

2008-06-09 Thread Gerhard Häring
Gandalf wrote: [...] I solved the problem by entering data manually but now the problem is that i had to delete this function: con.text_factory = str and now I can't see the data that I entered thought my sqlite manager Then apparently there is still non-UTF-8 data in the database. Perhaps SQ

Re: lists to save in a tuple

2008-06-09 Thread Gerhard Häring
Nader wrote: Hello, I have two lists and would save them in a tuple. a = [1,2,3] b = ['a','b','c'] with the next statement I can do that: t = [(x,y), for x in a for y in b] This gives the next list: [(1,'a'),(1,'b'),(1,'c'), (2,'a'),(2,'b'),(2,'c'), (3,'a'),(3,'b'), (3,'c')] But I want the

Re: mysql to sqlite

2008-06-10 Thread Gerhard Häring
Gandalf wrote: I'm trying to convert mysql database to sqlite. is their any free tool that does that? I can convert my mysql db to XML file through phpmyadmin, will it be easier to convert from XML to SQlite then from Mysql? Did you look at http://www.sqlite.org/cvstrac/wiki?p=ConverterTools

Re: problems with opening files due to file's path

2008-06-10 Thread Gerhard Häring
Alexnb wrote: Okay, so what I want my program to do it open a file, a music file in specific, and for this we will say it is an .mp3. Well, I am using the system() command from the os class. [...] system("\"C:\Documents and Settings\Alex\My Documents\My Music\Rhapsody\Bryanbros\Weezer\(2001)\04

Re: Python regex question

2008-06-11 Thread Gerhard Häring
Tim van der Leeuw wrote: Hi, I'm trying to create a regular expression for matching some particular XML strings. I want to extract the contents of a particular XML tag, only if it follows one tag, but not follows another tag. Complicating this, is that there can be any number of other tags in

Re: Parallel python + ??

2008-06-11 Thread Gerhard Häring
Thor wrote: Hi, I am running a program using Parallel Python and I wonder if there is a way/module to know in which CPU/core the process is running in. Is that possible? This is of course OS-specific. On Linux, you can parse the proc filesystem: >>> open("/proc/%i/stat" % os.getpid()).read().

Re: Summing a 2D list

2008-06-12 Thread Gerhard Häring
Mark wrote: John, it's a QuerySet coming from a database in Django. I don't know enough about the structure of this object to go into detail I'm afraid. [...] Then let the database do the summing up. That's what it's there for :-) select user, sum(score) from score_table group by user or some

Counting things fast - was Re: Summing a 2D list

2008-06-12 Thread Gerhard Häring
Aidan wrote: does this work for you? users = [1,1,1,2,2,3,4,4,4] score = [0,1,5,3,1,2,3,3,2] d = dict() for u,s in zip(users,score): if d.has_key(u): d[u] += s else: d[u] = s for key in d.keys(): print 'user: %d\nscore: %d\n' % (key,d[key]) I've recently had the very same prob

Re: Summing a 2D list

2008-06-13 Thread Gerhard Häring
BJörn Lindqvist wrote: [...] Here is another solution: from itertools import groupby from operator import itemgetter users = [1, 1, 1, 2, 2, 3, 4, 4, 4] scores = [0, 1, 5, 3, 1, 2, 3, 3, 2] for u, s in groupby(zip(users, scores), itemgetter(0)): print u, sum(y for x, y in s) Except that

Re: sqlite3 and Python 2.5.1

2008-06-16 Thread Gerhard Häring
milan_sanremo wrote: > I have sqlite installed, but when I try to import sqlite3 I receive: > > Python 2.5.1 (r251:54863, Nov 3 2007, 02:54:36) [C] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. import sqlite3 > Traceback (most recent call last): > File

Re: Numeric type conversions

2008-06-17 Thread Gerhard Häring
John Dann wrote: I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content occurs as

Re: Execute a script on a remote machine

2008-06-20 Thread Gerhard Häring
srinivasan srinivas wrote: Hi, My requirement is i have to execute a python script on a remote machine as a subprocess from a python script and to get the subprocess pid of the process running the script. Is there anyway to do that?? I have used subprocess.popen() method to do that. I have done

Re: Execute a script on a remote machine

2008-06-20 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 srinivasan srinivas wrote: > Is there any other way rather than communicating back to the caller? No, the remote PID isn't magically transferred via RSH. The remote script must communicate the PID back. Just writing it remotely as first line and on t

Re: Sqlite3 textfactory and user-defined function

2008-06-21 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > I've run into a problem with text encoding in the Sqlite3 module. I > think it may be a bug. By default sqlite3 converts strings in the > database from UTF-8 to unicode. This conversion can be controlled by > changing the connection's text_factory. > > I have a databa

Re: Plz decompyle my file

2008-06-25 Thread Gerhard Häring
Swapan wrote: [nothing] Just ask Dj_lucifer or Vital6630i for the original source code. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread Gerhard Häring
ShashiGowda wrote: Hey there i made a script to download all images from a web site but it runs damn slow though I have a lot of bandwidth waiting to be used please tell me a way to use urllib to open many connections to the server to download many pics simultaneously Any off question suggest

<    1   2   3   >