os.path.normpath

2006-08-18 Thread placid
Hi all, I was just wondering if there is a anti-os.path.normpath function? For example if i have the path C:\Program Files\Games i want to anti-os.path.normpath is so that it becomes C:\\Program Files\\Games ? Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.normpath

2006-08-18 Thread placid
placid wrote: Hi all, I was just wondering if there is a anti-os.path.normpath function? For example if i have the path C:\Program Files\Games i want to anti-os.path.normpath is so that it becomes C:\\Program Files\\Games ? Cheers Ahh ignore my post. I was using abspath, and normpath is

sum and strings

2006-08-18 Thread Paddy
I was browsing the Voidspace blog item on Flattening Lists, and followed up on the use of sum to do the flattening. A solution was: nestedList = [[1, 2], [3, 4], [5, 6]] sum(nestedList,[]) [1, 2, 3, 4, 5, 6] I would not have thought of using sum in this way. When I did help(sum) the docstring

sorted

2006-08-18 Thread thomas
Hi NG I what to used the sorted function, and im getting this error Traceback (most recent call last): File F:\home\thomas\src\guisample\test1.py, line 59, in ? main() File F:\home\thomas\src\guisample\test1.py, line 31, in main sorted(cords, key=operator.itemgetter(1))

Re: wxPython Grid Question

2006-08-18 Thread jean-michel bain-cornu
I'm wonderg if there is a way to make a subclass of wx.grid.Grid in which the coloumn labels for the grid appear on the bottom of the grid instead of the top. follow that lead. But jean-michel has two good points: it could be easier to use 2 grids and http://wxpython.org/maillist.php would

Re: sorted

2006-08-18 Thread thomas
Dennis Lee Bieber skrev: On Fri, 18 Aug 2006 09:31:54 +0200, thomas [EMAIL PROTECTED] declaimed the following in comp.lang.python: I what to used the sorted function, and im getting this error snip what do I needs to import, to use this function ? Uhm... the entire 2.4

RE: Looking For mp3 ID Tag Module

2006-08-18 Thread Tim Golden
[Tim Daneliuk] | audio[title'] = Something based on the filename that has unicode | chars in it | | UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc | in position | 56: ordinal not in range(128) | I am trying to set the title based on the filename. The file | is in a Win32 |

Re: It is __del__ calling twice for some instances?

2006-08-18 Thread Duncan Booth
Max Yuzhakov wrote: Why for some instance __del__ called twice? Such behaviour of __del__ seems to me unpredictable. Here's a slightly modified version of your code. The 51st object destroyed gets its __del__ method called twice. It doesn't matter how long your loop is, every 50th object

Re: python-dev and setting up setting up f2py on Windows XP

2006-08-18 Thread Sile
Hi John, Thank you very much for your help and resolving my issue with python-dev. I'll hopefully get my problem sorted today, if not I'm sure I'll be back with more questions! The C compiler I'm using is Microsoft Visual Studio 8. I have been told there are potential compatibility issues between

Re: python-dev and setting up setting up f2py on Windows XP

2006-08-18 Thread Sile
Hi John, Thank you very much for your help and resolving my issue with python-dev. I'll hopefully get my problem sorted today, if not I'm sure I'll be back with more questions! The C compiler I'm using is Microsoft Visual Studio 8. I have been told there are potential compatibility issues between

Re: python-dev and setting up setting up f2py on Windows XP

2006-08-18 Thread Sile
Thanks Anand ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Nick Craig-Wood
Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) declaimed the following in comp.lang.python: Question: import subprocess, StringIO input = StringIO.StringIO(abcdefgh\nabc\n) Here you override the builtin

Re: Which field is Python suitable to do some tasks?

2006-08-18 Thread Richard Jones
many_years_after wrote: hello , members: I have basic knowledge of python programming. But i don't know what to do next step. I don't know in which field I should learn more about python and finally finish some tasks. Can you give me some ideas? http://www.pyweek.org/ Richard

Re: It is __del__ calling twice for some instances?

2006-08-18 Thread Duncan Booth
Duncan Booth wrote: As to why it happens, there is a mechanism in Python to stop unlimited stack being used when objects are freed: when the stack gets too deep then instead of being released, the Py_DECREF call puts the object into a trashcan list and the objects aren't released until the

crash in wx.TreeListCtrl SelectItem()

2006-08-18 Thread Johannes Lochmann
Hello list, I have a strange crash (segfault on FreeBSD) that I can not reliably reproduce and therefore unfortunately can not provide a self contained test case at the moment. Here is what I do (and what works almost always, but sometimes crashes): 1) find an item in a wx.TreeListCtrl by its

MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Dirk Hagemann
Hi! Is it somehow possible to access an MS SQL Server database from python by NT-Authentication or do I have only the possibility to use an SQL-Account with DB = odbc.odbc(myDB/myAccount/myPW) ? Kind regards Dirk -- http://mail.python.org/mailman/listinfo/python-list

find item in wx.TreeListCtrl by pydata code snippet

2006-08-18 Thread Johannes Lochmann
Hello list, here is a small code snippet to recursively search a wx.TreeListCtrl for an item with specific pydata. Feel free to comment! def recursiveFindItemByPydata(self, parent, pydata):     item, cookie = self.GetFirstChild(parent)     while item:         if self.GetPyData(item) ==

who needs python when u have happs?

2006-08-18 Thread gavino
What applications benefit from HAppS? HTTP requests and SMTP envelopes encapsulate transactions and not vice versa. Note: doing otherwise with LAMP is considered bad design because it implies a requirement to maintain and garbage collect database connections arbitrarily. So this should not be a

RE: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Tim Golden
[Dirk Hagemann] | Hi! | Is it somehow possible to access an MS SQL Server database from python | by NT-Authentication or do I have only the possibility to use an | SQL-Account with DB = odbc.odbc(myDB/myAccount/myPW) ? (dsn examples from http://www.connectionstrings.com/) + Object Craft MSSQL

Subprocess quote problem

2006-08-18 Thread Adriano Monteiro
Hi Folks, I'm working on a script that executes a command with arbitrary options. Most of its options works fine with subprocess, but at least one (as far as I know) is giving me a headache. The program that I'm trying to execute is Nmap, and the problematic option is the -iL, that is used to

Re: Looking For mp3 ID Tag Module

2006-08-18 Thread Iain King
Tim Daneliuk wrote: Iñigo Serna wrote: On 8/18/06, Tim Daneliuk [EMAIL PROTECTED] wrote: try mutagen. http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen This module is more-or-less exactly what I needed. However, I am running into problems when the filenames or ID tags

Re: Subprocess quote problem

2006-08-18 Thread Fredrik Lundh
Adriano Monteiro wrote: I'm working on a script that executes a command with arbitrary options. Most of its options works fine with subprocess, but at least one (as far as I know) is giving me a headache. The program that I'm trying to execute is Nmap, and the problematic option is the -iL,

Re: sum and strings

2006-08-18 Thread Fredrik Lundh
Sybren Stuvel wrote: Why not make sum work for strings too? Because of there should only be one way to do it, and that way should be obvious. I would have thought that performance and proper use of English was more relevant, though. /F --

Re: sum and strings

2006-08-18 Thread Paul Rubin
Sybren Stuvel [EMAIL PROTECTED] writes: Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, Those are obvious??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Cameron Laird
In article [EMAIL PROTECTED], Nick Craig-Wood [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) declaimed the following in comp.lang.python: Question: import subprocess, StringIO input =

Re: sum and strings

2006-08-18 Thread Georg Brandl
Paul Rubin wrote: Sybren Stuvel [EMAIL PROTECTED] writes: Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, Those are obvious??? Why would you try to sum up strings? Besides, the ''.join idiom is quite

RE: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Tim Golden
[Dirk Hagemann] | I think the adodbapi module is interesting. I just tried it | out but got this error: | 'Exception occurred.', (0, 'Microsoft OLE DB Provider for ODBC | Drivers', [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed | for user '(null)'. Reason: Not associated with a

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-18 Thread Georg Brandl
tobiah wrote: Suppose I do: myfoo = Foo('grapes', 'oranges') And in the __init__() of Foo, there is a real problem with the consumption of fruit. Is there a clean way to ensure that myfoo will be None after the call? Would the __init__() just do del(self), or is there a better way

Re: Optimizing Inner Loop Copy

2006-08-18 Thread Paul McGuire
Mark E. Fenner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, snip Here's my class of the objects being copied: class Rule(list): def __init__(self, lhs=None, rhs=None, nClasses=0, nCases=0): self.nClasses = nClasses self.nCases = nCases Ok, so

Text to MP3 using pyTTS - Non-programmer question

2006-08-18 Thread seyeRMReyes
I'm not a programmer, but I'd like to make a program that will open and read a txt file and output to a mp3 file. I don't need to ever hear the voice, but I'd like the program to direct I've been google'ing around and have found a few tutorials about converting pdfs to mp3 and converting typed

Re: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Dirk Hagemann
Hi Tim! I think the adodbapi module is interesting. I just tried it out but got this error: 'Exception occurred.', (0, 'Microsoft OLE DB Provider for ODBC Drivers', [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Laurent Pointal
Cameron Laird a écrit : In article [EMAIL PROTECTED], Nick Craig-Wood [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 17 Aug 2006 17:16:25 +, [EMAIL PROTECTED] (Cameron Laird) declaimed the following in comp.lang.python: Question: import subprocess,

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-18 Thread olsongt
tobiah wrote: Suppose I do: myfoo = Foo('grapes', 'oranges') And in the __init__() of Foo, there is a real problem with the consumption of fruit. Is there a clean way to ensure that myfoo will be None after the call? Would the __init__() just do del(self), or is there a better way to

Re: Optimizing Inner Loop Copy

2006-08-18 Thread Mark E. Fenner
Paul McGuire wrote: Mark E. Fenner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, snip Here's my class of the objects being copied: class Rule(list): def __init__(self, lhs=None, rhs=None, nClasses=0, nCases=0): self.nClasses = nClasses

Re: Optimizing Inner Loop Copy

2006-08-18 Thread Paul McGuire
Mark E. Fenner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Save inheritance for the true is-a relationships among your problem domain classes. For instance, define a base Rule class, and then you can extend it with things like DeterministicRule, ProbabilisticRule,

Re: Creating Charts in Excel with pyExcelerator.ExcelMagic

2006-08-18 Thread implicate_order
Gentlemen, Thanks for your responses. I also found some additional threads on this newsgroup that gave me insight into how to use the MS Excel com objects (or whatever they are called)... So I used this: xl = win32com.client.Dispatch(Excel.Application) wb = xl.Workbooks.Open(outfile01) prodws

Re: sqlite3 or mysqldb?

2006-08-18 Thread John Salerno
Paul Boddie wrote: There's plenty of scope for writing non-standard SQL even in the most common operations. Moreover, defining tables can be awkward because the set of supported data types and the names used can vary in a seemingly unnecessary fashion between systems. Good point. I forgot

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Fredrik Lundh
Cameron Laird wrote: Your interactive session does indeed exhibit the behavior that puzzles me. My expectation was that StringIO and the std* parameters to Popen() were made for each other; certainly there are many cases where stdout and stderr can be redirected *to* a StringIO. Is it

Documenting a package with Pydoc

2006-08-18 Thread Rob Cowie
I have searched this group and the wider net to find an answer to this, but I haven't been successful. Pydoc seems to be capable of writing documentation for all modules within a package by simply pointing it to the package on the command line... pydoc -w packagename_without_/ Certainly, the

How to draw line on Image?

2006-08-18 Thread Daniel Mark
Hello all: I want to draw some shapes, such as lines, circles on an image. The input to the program is an image and the output from the program is a superimposed image. what kind of document or functions I should take a look for searching this question? The program doesn't show the image, but

Re: How to draw line on Image?

2006-08-18 Thread David Isaac
Daniel Mark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to draw some shapes, such as lines, circles on an image. http://www.pythonware.com/library/pil/handbook/psdraw.htm hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: crash in wx.TreeListCtrl SelectItem()

2006-08-18 Thread jean-michel bain-cornu
Hi, I have a strange crash (segfault on FreeBSD) that I can not reliably reproduce and therefore unfortunately can not provide a self contained test case at the moment. Here is what I do (and what works almost always, but sometimes crashes): 1) find an item in a wx.TreeListCtrl by its

Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-18 Thread Dieter Deyke
[EMAIL PROTECTED] writes: I'm not a programmer, but I'd like to make a program that will open and read a txt file and output to a mp3 file. I don't need to ever hear the voice, but I'd like the program to direct I've been google'ing around and have found a few tutorials about converting

Re: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Dirk Hagemann
My windows-user has already access-permission to the database. Thanks for the exmaple - I will try it out on monday! :-) Enjoy your weekend! Dirk -- http://mail.python.org/mailman/listinfo/python-list

Type conversion?

2006-08-18 Thread KraftDiner
I have the following code... import array len32 = array.array('L') len16 = array.array('H') len32.append(0) len16.append(0) y = len32[0] print y.__class__ type 'long' z = len16[0] print z.__class__ type 'int' how can I change Zs type to long? Or how how can I change an arrays type? --

Simple Python App Server

2006-08-18 Thread tom.purl
I use the pyGTD script to manage my todo lists and such. From Vim, I shell out a call to the gtd.py script, which updates my todo.txt file after update one of the related pyGTD files. Since I make a lot of updates to the related pyGTD files, I execute the gtd.py script dozens of times a day.

Re: Type conversion?

2006-08-18 Thread Rob Cowie
KraftDiner wrote: I have the following code... import array len32 = array.array('L') len16 = array.array('H') len32.append(0) len16.append(0) y = len32[0] print y.__class__ type 'long' z = len16[0] print z.__class__ type 'int' how can I change Zs type to long? z_long = long(z)

Re: sum and strings

2006-08-18 Thread bearophileHUGS
Paul Rubin: Sybren Stuvel: Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, Those are obvious??? They aren't fully obvious (because they are methods of the separator string), but after reading some

Re: sum and strings

2006-08-18 Thread Steve Holden
[EMAIL PROTECTED] wrote: Paul Rubin: Sybren Stuvel: Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, Those are obvious??? They aren't fully obvious (because they are methods of the separator

Re: How to draw line on Image?

2006-08-18 Thread Paul McGuire
David Isaac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Daniel Mark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to draw some shapes, such as lines, circles on an image. http://www.pythonware.com/library/pil/handbook/psdraw.htm hth, Alan Isaac

Re: Need a compelling argument to use Django instead of Rails

2006-08-18 Thread aaronwmail-usenet
Damjan wrote: Starting a new Apache process with python included (trough mod_python) is even worse than CGI. Yes, but I think only for the first interaction after being dormant for a period. In fact I've noticed that hitting http://www.xfeedme.com the first time is usually slow. But once the

amd64

2006-08-18 Thread Robin Becker
Does anyone know if it's possible to run python as a 32 bit app on AMD64's? One of our host providers AMD Athlon 64 3000+ and we are currently using a celeron which is real slow. The problem is that this machine would be a backup for another which is 32 pentium 4. If I have to recompile/debug

Re: Subprocess confusion: how file-like must stdin be?

2006-08-18 Thread Cameron Laird
In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: Cameron Laird wrote: Your interactive session does indeed exhibit the behavior that puzzles me. My expectation was that StringIO and the std* parameters to Popen() were made for each other; certainly there are many cases

Re: How to draw line on Image?

2006-08-18 Thread Claudio Grondi
Paul McGuire wrote: David Isaac [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Daniel Mark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to draw some shapes, such as lines, circles on an image. http://www.pythonware.com/library/pil/handbook/psdraw.htm hth,

Re: sum and strings

2006-08-18 Thread Paddy
Sybren Stuvel wrote: Paddy enlightened us with: Well, after all the above, there is a question: Why not make sum work for strings too? Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, which are

Re: Type conversion?

2006-08-18 Thread KraftDiner
Rob Cowie wrote: KraftDiner wrote: I have the following code... import array len32 = array.array('L') len16 = array.array('H') len32.append(0) len16.append(0) y = len32[0] print y.__class__ type 'long' z = len16[0] print z.__class__ type 'int' how can I change

Re: sum and strings

2006-08-18 Thread Paddy
Sybren Stuvel wrote: Paddy enlightened us with: Well, after all the above, there is a question: Why not make sum work for strings too? Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join methods, which are

Re: Type conversion?

2006-08-18 Thread Duncan Booth
KraftDiner wrote: In C++ you can cast one class type to another if you override the operator= Then you can convert one class type to another... In Python it would appear that the left hand side of the assignment operator is not used to determine if a cast is necessary. So how would I do

Re: Simple Python App Server

2006-08-18 Thread Neil Cerutti
On 2006-08-18, tom.purl [EMAIL PROTECTED] wrote: I use the pyGTD script to manage my todo lists and such. From Vim, I shell out a call to the gtd.py script, which updates my todo.txt file after update one of the related pyGTD files. Since I make a lot of updates to the related pyGTD files, I

Re: Simple Python App Server

2006-08-18 Thread Diez B. Roggisch
tom.purl schrieb: I use the pyGTD script to manage my todo lists and such. From Vim, I shell out a call to the gtd.py script, which updates my todo.txt file after update one of the related pyGTD files. Since I make a lot of updates to the related pyGTD files, I execute the gtd.py script

soap comlex data to plain xml

2006-08-18 Thread Ig B
Hi all,would anyone give me a hint how to get SOAP data as plain XML and not as complex datathis is sample code: myProxy = SOAPpy.SOAPProxy(MY_SERVICE_PATH, header = my_headers) query = SOAPpy.structType () result = myProxy.callMyProcedure(query) result returned as complex data, but i need plain

couple more questions about sqlite

2006-08-18 Thread John Salerno
I've been looking around and reading, and I have a few more questions about SQLite in particular, as it relates to Python. 1. What is the current module to use for sqlite? sqlite3? or is that not out until Python 2.5? 2. What's the difference between sqlite and pysqlite? Do you need both,

a bug in list.remove?

2006-08-18 Thread Astan Chee
Hi all, I have 2 lists. What Im doing is check the first list and remove all occurances of the elements in the second list from the first list, like so: ps = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] qs = [6,7,8,9,10,11,12,1,2] for p in ps: if p in qs: ps.remove(p) The problem Im

how do you get the name of a dictionary?

2006-08-18 Thread jojoba
Hello! Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary (i.e. 'Banana')? thanks to anyone who has time to answer this nube question! jojoba --

Disable close button in management window.(KDE- pyQT)

2006-08-18 Thread Gabriel - BR
Hi,,, Is possible disable the close button in KDE management window? Using python+qt? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: amd64

2006-08-18 Thread Paul McGuire
Robin Becker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does anyone know if it's possible to run python as a 32 bit app on AMD64's? One of our host providers AMD Athlon 64 3000+ and we are currently using a celeron which is real slow. The problem is that this machine would be a

Re: how do you get the name of a dictionary?

2006-08-18 Thread Tim Chase
Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary (i.e. 'Banana')? AFAIK, there's no easy/good way of doing this because that name is just a handle to an

Re: amd64

2006-08-18 Thread [EMAIL PROTECTED]
Robin Becker wrote: Does anyone know if it's possible to run python as a 32 bit app on AMD64's? One of our host providers AMD Athlon 64 3000+ and we are currently using a celeron which is real slow. The problem is that this machine would be a backup for another which is 32 pentium 4. If I

Re: how do you get the name of a dictionary?

2006-08-18 Thread Andy Terrel
jojoba wrote: Hello! Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary (i.e. 'Banana')? thanks to anyone who has time to answer this nube question! jojoba

Re: a bug in list.remove?

2006-08-18 Thread bearophileHUGS
Astan Chee: (This is a small trap of Python, that it shares with some other languages, and it shows that it may exist a language with a higher level than Python.) Generally in Python you can't modify a sequence that you are iterating on. There are some ways to avoid the problem. You can create a

Re: a bug in list.remove?

2006-08-18 Thread Tim Chase
I have 2 lists. What Im doing is check the first list and remove all occurances of the elements in the second list from the first list, like so: ps = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] qs = [6,7,8,9,10,11,12,1,2] for p in ps: if p in qs: ps.remove(p) The problem Im

Re: The decentralized nature of the Python community is driving me crazy

2006-08-18 Thread Mike Orr
[EMAIL PROTECTED] wrote: hi everyone, I am the first of what may be hundreds of refugees from the Perl community. Not only is Python a more productive language, with many more nice apps, but the people are friendly as well... waaay more friendly than the Perl crowd. But I must say the one

Re: Type conversion?

2006-08-18 Thread Paul McGuire
KraftDiner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In C++ you can cast one class type to another if you override the operator= Then you can convert one class type to another... In Python it would appear that the left hand side of the assignment operator is not used to

Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-18 Thread seyeRMReyes
Thanks for the script. Are there any online python intrepreters? I'd like to play around with the script. I don't have access to my home PC. -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-18 Thread Georg Brandl
Paddy wrote: Sybren Stuvel wrote: Paddy enlightened us with: Well, after all the above, there is a question: Why not make sum work for strings too? Because of there should only be one way to do it, and that way should be obvious. There are already the str.join and unicode.join

Re: a bug in list.remove?

2006-08-18 Thread Astan Chee
Tim Chase wrote: I have 2 lists. What Im doing is check the first list and remove all occurances of the elements in the second list from the first list, like so: ps = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] qs = [6,7,8,9,10,11,12,1,2] for p in ps: if p in qs:

Re: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Jarek Zgoda
Dirk Hagemann napisał(a): 'Exception occurred.', (0, 'Microsoft OLE DB Provider for ODBC Drivers', [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection., None, 0, -2147217843), None) This indicates, that

Re: MS SQL Server: NT Authentication. Possible?

2006-08-18 Thread Jarek Zgoda
Tim Golden napisał(a): import adodbapi db = adodbapi.connect (Provider=sqloledb;Data Source=VODEV1;Initial Catalog=EVOBACK;Integrated Security=SSPI;) This kind of connection doesn't work for me. I think it's some misconfiguration on AD side, but I still get not associated with trusted

Re: sum and strings

2006-08-18 Thread Fredrik Lundh
Paddy wrote: Here is where I see the break in the 'flow': 1+2+3 6 sum([1,2,3], 0) 6 [1] + [2] +[3] [1, 2, 3] sum([[1],[2],[3]], []) [1, 2, 3] '1' + '2' + '3' '123' sum(['1','2','3'], '') Traceback (most recent call last): File interactive input, line 1, in ? TypeError: sum()

Re: how do you get the name of a dictionary?

2006-08-18 Thread Fredrik Lundh
Andy Terrel wrote: for i in dir(): if eval(i) == Banana: print i (sound of head hitting desk) /F -- http://mail.python.org/mailman/listinfo/python-list

Re: couple more questions about sqlite

2006-08-18 Thread andychambers2002
2. What's the difference between sqlite and pysqlite? Do you need both, just one, or is one an older version of the same thing? To access your database from python you need both (or some alternative to pysqlite) 3. What's the difference between the command line program called sqlite3 and

efficient memoize decorator?

2006-08-18 Thread [EMAIL PROTECTED]
im plugging away at the problems at http://www.mathschallenge.net/index.php?section=project im trying to use them as a motivator to get into advanced topics in python. one thing that Structure And Interpretation Of Computer Programs teaches is that memoisation is good. all of the memoize

timezones and time_t

2006-08-18 Thread MrBlueSky
Hi, I've got a Python application that (as well as lots of other stuff!) has to translate time_t values into strings in the TZ of the users choice. Looking at the Python Library Reference, I can see no platform independent way of setting the TZ that time.localtime() returns - tzset() is marked as

Re: efficient memoize decorator?

2006-08-18 Thread [EMAIL PROTECTED]
sorry memoize is http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496879 memoize2 is http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466320 im plugging away at the problems at http://www.mathschallenge.net/index.php?section=project im trying to use them as a motivator to get

Re: amd64

2006-08-18 Thread [EMAIL PROTECTED]
if the install is 64 bit, you will hit trouble i used the guide here http://www.debian-administration.org/articles/356 on my 64 bit debian system to get 32bit apps available if they have a particular distro install, usually the package management tools for it can add most python modules you will

Re: The decentralized nature of the Python community is driving me crazy

2006-08-18 Thread infidel
And then you have discussion and yet again, there is no perlmonks.org for Python. We have this, IRC, and what else? There's also http://planet.python.org, which is an aggregator of python blogs that I check many times a day for new posts. -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you get the name of a dictionary?

2006-08-18 Thread John Salerno
Fredrik Lundh wrote: Andy Terrel wrote: for i in dir(): if eval(i) == Banana: print i (sound of head hitting desk) /F lol -- http://mail.python.org/mailman/listinfo/python-list

Re: couple more questions about sqlite

2006-08-18 Thread John Salerno
[EMAIL PROTECTED] wrote: 2. What's the difference between sqlite and pysqlite? Do you need both, just one, or is one an older version of the same thing? To access your database from python you need both (or some alternative to pysqlite) I can understand this in terms of MySQL being one

Safearray question

2006-08-18 Thread bumperdoc
Hi I'm using win32com.client to dispatch a COM serverone of the interface methods has the below parameter: ..., [in, out] SAFEARRAY(BYTE) *Buffer, ... This method goes and queries something and puts it in this buffer...how can I use this method in Python? What type of variable needs to be

Re: how do you get the name of a dictionary?

2006-08-18 Thread Tim Chase
for i in dir(): if eval(i) == Banana: print i (sound of head hitting desk) /F lol As freakish as the solution was, it's not too far off from something that actually works (mostly, kinda sorta): banana = {} spatula = banana propane = {} [name for name in dir()

Re: sqlite3 or mysqldb?

2006-08-18 Thread Ravi Teja
To learn SQL SQLite should be enough - it has all the basics, just as MySQL, while it doesn't require any server/client configuration (encoding configuration in MySQL is real PITA). But if you want any serious SQL, go with any freely available *real SQL server*, like Firebird or PostgreSQL.

Re: The Semicolon Wars as a software industry and human condition

2006-08-18 Thread Michele Dondi
On 17 Aug 2006 06:42:55 -0700, Xah Lee [EMAIL PROTECTED] wrote: Of interest: • The Semicolon Wars, by Brian Hayes. 2006. http://www.americanscientist.org/template/AssetDetail/assetid/51982 [snip] • What Languages to Hate, Xah Lee, 2002

Search or compai problem

2006-08-18 Thread Gallagher, Tim (NE)
I am new to python and I want to compare 2 strings, here is my code: [start] import active_directory import re lstUsers = [] users = active_directory.root() for user in users.search (sn='gallagher'): lstUsers.append(user.samAccountName) print

Re: It is __del__ calling twice for some instances?

2006-08-18 Thread Patrick Maupin
Duncan Booth wrote: Duncan Booth wrote: As to why it happens, there is a mechanism in Python to stop unlimited stack being used when objects are freed: when the stack gets too deep then instead of being released, the Py_DECREF call puts the object into a trashcan list and the objects

Python for EXIF-info-additions ?

2006-08-18 Thread Bror Johansson
Is there somewhere some Python-module that can be used for adding EXIF-info to JPEG files? (Modules for extraction of EXIF-data are easily found, but lacks - as I see it - capacity to add new tags.) /BJ -- http://mail.python.org/mailman/listinfo/python-list

PyThreadState_Swap(NULL)

2006-08-18 Thread Bryan
hi, i've written a program that uses python c api code that lives in a shared library that is loaded by a custom apache module (mod_xxx). this python c api code all works correctly under our test server and under apache but only if mod_python isn't loaded. when apache loads mod_python as

Re: how do you get the name of a dictionary?

2006-08-18 Thread Andy Terrel
Why bang your head? It was a stupid hack that has lots of problems, but done in a way that is readable. Sure I could do something more functional or one lined like: Banana={} names = filter(lambda x:id(eval(x))==id(Banana),dir()) but I am guessing that it is harder to read by many. Anywho I

Re: how do you get the name of a dictionary?

2006-08-18 Thread Georg Brandl
Andy Terrel wrote: Why bang your head? Because there's no chance that the original request is sane. If you want your objects to know their name, give them a name as an attribute. It was a stupid hack that has lots of problems, but done in a way that is readable. Sure I could do something

urllib2, proxies and https

2006-08-18 Thread Astan Chee
Hi again, According to https://demo.launchpad.net/products/python/+bug/56872 or more specifically, the example of its working code: http://librarian.demo.launchpad.net/3507227/urllib2_proxy_auth.py I can use urllib2 via proxy to access a https site(specifically hooking it up to libgmail). The

Re: It is __del__ calling twice for some instances?

2006-08-18 Thread Max Yuzhakov
Duncan Booth wrote: DB I figured out what is going on in the code to deallocate an old-style class DB instance: DB DB The reference count is temporarily incremented. DB DB If the class has a __del__ method then a descriptor is created for the DB method and called. When the call

  1   2   >