Re: weird embedding problem

2007-12-07 Thread grbgooglefan
On Dec 7, 2:01 pm, DavidM <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm embedding python in a C prog which is built as a linux shared lib. > > The prog is linked against libpython, and on startup, it calls > Py_Initialize(). > > The prog imports a pure-python script. The script starts up ok, but whe

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread grbgooglefan
On Dec 7, 3:07 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 07 Dec 2007 01:24:57 -0300, grbgooglefan <[EMAIL PROTECTED]> > escribió: > > > > > > > On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> En Thu, 06 Dec 2007 23:27:15 -0300, grbgooglefan <[EMAIL P

Any simpler way to do this

2007-12-07 Thread Lars Johansen
I have a function that looks like this: def Chooser(color): if color == "RED": x = term.RED elif color == "BLUE": x = term.BLUE elif color == "GREEN": x = term.GREEN elif color == "YELLOW": x = term.YE

Re: weird embedding problem

2007-12-07 Thread Graham Dumpleton
On Dec 7, 5:01 pm, DavidM <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm embedding python in a C prog which is built as a linux shared lib. > > The prog is linked against libpython, and on startup, it calls > Py_Initialize(). > > The prog imports a pure-python script. The script starts up ok, but whe

[NEWB] Dictionary instantiation?

2007-12-07 Thread Matt_D
Hello there, this is my first post to the list. Only been working with Python for a few days. Basically a complete newbie to programming. I'm working with csv module as an exercise to parse out a spreadsheet I use for work.(I am an editor for a military journalism unit) Not trying to do anything u

Re: Any simpler way to do this

2007-12-07 Thread Christian Heimes
Lars Johansen wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": > x = term.GREEN > elif col

Re: Any simpler way to do this

2007-12-07 Thread Bruno Desthuilliers
Lars Johansen a écrit : > I have a function that looks like this: > > def Chooser(color): Bad naming (noun instead of a verb) and not conformant to PEP 08 (function names should be all_lower) > if color == "RED": > x = term.RED > elif color == "BLUE": >

ftplib.nlst gives error on empty directory

2007-12-07 Thread loial
Trying to use ftplib.FTP.nlst() method to list the files in a directory on a FTP server. It works fine except when there are no files in the directory. Then it gives the error ftplib.error_perm: 550 No files found. How can I handle this cleanly? -- http://mail.python.org/mailman/listinfo/py

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread sturlamolden
On 7 Des, 08:07, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > Does it mean, I can embed Python in C# as well with the same APIs? > > No; you can use the Python API in a native C++ application (the Python > code is plain C, but all the include files have the 'extern "C" {}' > declarations). F

Re: Dictionary instantiation?

2007-12-07 Thread Bruno Desthuilliers
Matt_D a écrit : (snip whole posts) Please Matt do the world a favour : don't repost the whole damn think just to add a couple lines !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary instantiation?

2007-12-07 Thread Bruno Desthuilliers
Matt_D a écrit : (snip) > Another newb question, same project: > > #Fetch author names > def rem_blank_authors(): #Function to remove entries with '' in the > AUTHOR field of the .csv > csv_list = list(csv_file) #Convert the open file to list format > for e-z mode editing > for row in csv_

Re: File to dict

2007-12-07 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > def lookupdmo(domain): > lines = open('/etc/virtual/domainowners','r').readlines() > lines = [ [y.lstrip().rstrip() for y in x.split(':')] for x in > lines] > lines = [ x for x in lines if len(x) == 2 ] > d = dict() > for line in l

Re: Code Management

2007-12-07 Thread BlueBird
On Dec 2, 4:27 pm, BlueBird <[EMAIL PROTECTED]> wrote: > On Nov 26, 5:07 pm, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > > >Bluebird: > > > If you are using python 2.5, relative imports are no longer an > > issue:http://docs.python.org/whatsnew/pep-328.html > > It does not solve my problem, or I

File to dict

2007-12-07 Thread mrkafk
Hello everyone, I have written this small utility function for transforming legacy file to Python dict: def lookupdmo(domain): lines = open('/etc/virtual/domainowners','r').readlines() lines = [ [y.lstrip().rstrip() for y in x.split(':')] for x in lines] lines = [ x for x

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Christian Heimes
sturlamolden wrote: > The answer is YES. C# can access C functions exported by any DLL with > platform invoke. Since the Python C API is plain C and not C++ you can > gain access to it from C#. Import System.Runtime.InteropServices and > write wrappers like > > [DllImport("Python25.dll"), CallingC

Re: Erros when compiling a CPP program which uses CPython API functions

2007-12-07 Thread Christian Heimes
grbgooglefan wrote: > How do we resolve this error? The easiest way to solve all your problems is: make altinstall. It installs Python in PREFIX (usually /usr/local). Although it is possible to run Python in a build directory it is tricky and may not work for your own program. Christian -- ht

Re: Dictionary instantiation?

2007-12-07 Thread Tim Golden
Matt_D wrote: [... snip loads ...] > Wow, list spam. Indeed. > Sorry about this. Good. > Anyway, disregard my last two. I get it now. Glad to hear it. Might I suggest, though, that it's not necessary to repeat the entire history of the thread on every email. Unless you have reason to repr

Re: New subclass vs option in __init__

2007-12-07 Thread Carl Banks
On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: > It would seem that there are cases where one would be preferable over > the other: a) when the new behavior would modify a large portion of > the existing subclass, making a new subclass would be ideal; b) when > the new behavior changes

python and a 2 gigs Usb Stick (pure pythonic stick)

2007-12-07 Thread bussiere maillist
Hi, i've received for my birthday two usb key, and i had the idea to make the 2GB one a special python usb key. So far i've put on it : Movable Python My Python directory Iron Python Jython Instant django the file installation for : Python , iron python , jython , PIL , Pygame , Pywin32 The pdf i

Re: eclipse pywintypes.com_error

2007-12-07 Thread Spindle
On Dec 7, 3:59 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > gurkan wrote: > > i have treid the script : > > > #import active_directory > > import win32com.client > > > win32com.client.Dispatch ("ADODB.Command") > > #me = active_directory.find_user () > > > #print me > > > again i got the error : > >

Re: eclipse pywintypes.com_error

2007-12-07 Thread gurkan
On 7 Aralık, 15:59, Tim Golden <[EMAIL PROTECTED]> wrote: > gurkan wrote: > > i have treid the script : > > > #import active_directory > > import win32com.client > > > win32com.client.Dispatch ("ADODB.Command") > > #me = active_directory.find_user () > > > #print me > > > again i got the error : >

Re: splitting a words of a line

2007-12-07 Thread Paul McGuire
On Dec 6, 9:21 am, Sumit <[EMAIL PROTECTED]> wrote: > Hi , >I am trying to splitt a Line whihc is below of format , > > AzAccept PLYSSTM01 [23/Sep/2005:16:14:28 -0500] "162.44.245.32 CN= > cojack (890),OU=1,OU=Customers,OU=ISM-Users,OU=kkk > Secure,DC=customer,DC=rxcorp,DC=com" "pl

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : >> >>> The csv module is your friend. >> >> (slapping forehead) why the Holy Grail didn't I think about this? > > If that can make you feel better, a few years ago, I spent two > days writing my own (Squa

How does python build its AST

2007-12-07 Thread MonkeeSage
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it reads expressions? (If the former case, why can't functions be called before their definitions?) Thank

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 14:34, supercooper <[EMAIL PROTECTED]> wrote: > On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > I get the date/time of the dynamic update entries in a format, which > > is as far

Re: File to dict

2007-12-07 Thread mrkafk
> >>> def shelper(line): > ... return x.replace(' ','').strip('\n').split(':',1) Argh, typo, should be def shelper(x) of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: File to dict

2007-12-07 Thread mrkafk
> I guess Duncan's point wasn't the construction of the dictionary but the > throw it away part. If you don't keep it, the loop above is even more > efficient than building a dictionary with *all* lines of the file, just to > pick one value afterwards. Sure, but I have two options here, none of

Re: eclipse pywintypes.com_error

2007-12-07 Thread gurkan
On 7 Aralık, 15:40, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > i want to use active directory of my firm to user authentication.i am > > using active_directory module > > By the way, if what you want to do is user *authentication* (as > opposed to authorisation) then the a

Re: File to dict

2007-12-07 Thread Duncan Booth
Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Using two list comprehensions mean you construct two lists, which sucks > if it's a large file. Only if it is very large. You aren't duplicating the data except for entries with whitespace round them. If there isn't a lot of whitespace then the extra o

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > i want to use active directory of my firm to user authentication.i am > using active_directory module By the way, if what you want to do is user *authentication* (as opposed to authorisation) then the active_directory module won't be any good to you. You want to use eith

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > i want to use active directory of my firm to user authentication.i am > using active_directory module(Tim Golden's module - > http://tgolden.sc.sabren.com/python/active_directory.html). > > i am using windows vista with an administrative account,python > 2.5 ,eclipse 3.2

Re: Some python syntax that I'm not getting

2007-12-07 Thread Laurent Pointal
Chris a écrit : > On Dec 7, 2:31 pm, waltbrad <[EMAIL PROTECTED]> wrote: >> I understand how D['say'] gets you 5, But I still don't understand >> the line after the 5. >> >> How is the character 's' some special code? And I don't get what is >> going on with the % character. I'm used to it's use

eclipse pywintypes.com_error

2007-12-07 Thread gurkanserin
Hello everybody, i want to use active directory of my firm to user authentication.i am using active_directory module(Tim Golden's module - http://tgolden.sc.sabren.com/python/active_directory.html). i am using windows vista with an administrative account,python 2.5 ,eclipse 3.2 and pydev plugin,a

Re: Code Management

2007-12-07 Thread Marc Christiansen
BlueBird <[EMAIL PROTECTED]> wrote: > On Dec 2, 4:27 pm, BlueBird <[EMAIL PROTECTED]> wrote: >> On Nov 26, 5:07 pm, "Sergio Correia" <[EMAIL PROTECTED]> wrote: >> >> >Bluebird: >> >> > If you are using python 2.5, relative imports are no longer an >> > issue:http://docs.python.org/whatsnew/pep-328.

Re: JSON

2007-12-07 Thread Sion Arrowsmith
Joshua Kugler <[EMAIL PROTECTED]> wrote: >Known issue. See: >http://blog.extracheese.org/2007/07/when-json-isnt-json.html > >Neither project has fixed it it seems. Not sure which is actually >the "correct" way to do it, but it would be nice if they would agree. I think it's pretty clear (not ju

Re: File to dict

2007-12-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Dec 2007 04:44:25 -0800, mrkafk wrote: > Duncan Booth wrote: >> But why do you construct a dict from that input data simply to throw it >> away? > > Because comparing strings for equality in a loop is writing C in > Python, and that's exactly what I'm trying to unlearn. > > The proper

Re: File to dict

2007-12-07 Thread mrkafk
> The csv module is your friend. (slapping forehead) why the Holy Grail didn't I think about this? That should be much simpler than using SimpleParse or SPARK. Thx Bruno & everyone. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: >> Hello, >> >> From a zone-file of a Microsoft Active Directory integrated DNS server >> I get the date/time of the dynamic update entries in a format, which >> is as far as I know the hours since january 1st 19

Some python syntax that I'm not getting

2007-12-07 Thread waltbrad
Hello. Been studying Python for about a week now. I did a quick read of the tutorial in the manual and I'm reading Programming Python by Mark Lutz. I'm still getting used to the Python syntax, but I'm able to pretty much follow what is being said. But tonight Lutz was talking about implementing

Re: File to dict

2007-12-07 Thread Duncan Booth
Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: >> from __future__ import with_statement >> >> def loaddomainowners(domain): >> with open('/etc/virtual/domainowners','r') as infile: > > I've been thinking I have to use contextlib.closing for >

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread [EMAIL PROTECTED]
On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. Your guess appears to be of

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:50, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > >> Hello, > > > >> From a zone-file of a Microsoft Active Directory integrate

Re: New subclass vs option in __init__

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: >> It would seem that there are cases where one would be >> preferable over the other: a) when the new behavior would >> modify a large portion of the existing subclass, making a new >

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > >> Hello, > > >> From a zone-file of a Microsoft Active Directory integrated DNS server > >> I get the date/time of the dynamic update entries in a fo

Re: File to dict

2007-12-07 Thread Glauco
[EMAIL PROTECTED] ha scritto: > Hello everyone, > > I have written this small utility function for transforming legacy > file to Python dict: > > > def lookupdmo(domain): > lines = open('/etc/virtual/domainowners','r').readlines() > lines = [ [y.lstrip().rstrip() for y in x.split

Re: File to dict

2007-12-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hello everyone, (snip) > Say, I would like to transform a file containing entries like > the following into a list of lists with doublecolon treated as > separators, i.e. this: > > tm:$1$$:1010:6::/home/owner1/imap/domain1.tld/tm:/sbin/nologin > > would get

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Zentrader
If we use minutes from 2001, then 3566839 comes out as sometime in October, 2007 (6.78622 years). Close but no cigar. Is anyone familar enough with Excel to translate the formula or do we have to go a- googling? -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary instantiation?

2007-12-07 Thread Matt_D
On Dec 7, 12:33 pm, Matt_D <[EMAIL PROTECTED]> wrote: > On Dec 7, 12:27 pm, Matt_D <[EMAIL PROTECTED]> wrote: > > > > > On Dec 7, 11:42 am, Virgil Dupras <[EMAIL PROTECTED]> > > wrote: > > > > On Dec 7, 9:05 am, Matt_D <[EMAIL PROTECTED]> wrote: > > > > > Hello there, this is my first post to the l

Python 2.4.4, Segmentation fault

2007-12-07 Thread Ruslan Mashukov
Program terminated with signal 11, Segmentation fault. Environment: FreeBSD 6.2, Python 2.4.4, MySQLdb 1.2.2, SQLObject 0.9.1 I faced with an error in our multithreaded, network oriented application, wich interacts actively with MySQL database. Though I am not very experienced with FreeBSD and gd

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: >>> from __future__ import with_statement >>> >>> def loaddomainowners(domain): >>> with open('/etc/virtual/domainowners','r') as infile:

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Christian Heimes
grbgooglefan wrote: > I want to use Python's Windows (python25.dll) version to embed in my > C# (or atleast VC++) program for performing syntax checks on the > Python expressions which are later supposed to be evaluated at runtime > by another C++ program > > For this, I would like to use CPython

Re: [NEWB] Dictionary instantiation?

2007-12-07 Thread Bruno Desthuilliers
Matt_D a écrit : > Hello there, this is my first post to the list. Only been working with > Python for a few days. Basically a complete newbie to programming. > > I'm working with csv module as an exercise to parse out a spreadsheet > I use for work.(I am an editor for a military journalism unit)

Re: Any simpler way to do this

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:37 am, Lars Johansen <[EMAIL PROTECTED]> wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": >

Re: Dictionary instantiation?

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:05 am, Matt_D <[EMAIL PROTECTED]> wrote: > Hello there, this is my first post to the list. Only been working with > Python for a few days. Basically a complete newbie to programming. > > I'm working with csv module as an exercise to parse out a spreadsheet > I use for work.(I am an edit

Re: Can I embed Windows Python in C# or VC++?

2007-12-07 Thread Virgil Dupras
On Dec 7, 9:03 am, grbgooglefan <[EMAIL PROTECTED]> wrote: > On Dec 7, 3:07 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Fri, 07 Dec 2007 01:24:57 -0300, grbgooglefan <[EMAIL PROTECTED]> > > escribió: > > > > On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > > wro

Re: New subclass vs option in __init__

2007-12-07 Thread Carl Banks
On Dec 7, 9:36 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-07, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: > >> It would seem that there are cases where one would be > >> preferable over the other: a) when the new behavior wou

Re: File to dict

2007-12-07 Thread Neil Cerutti
On 2007-12-07, Duncan Booth <[EMAIL PROTECTED]> wrote: > from __future__ import with_statement > > def loaddomainowners(domain): > with open('/etc/virtual/domainowners','r') as infile: I've been thinking I have to use contextlib.closing for auto-closing files. Is that not so? -- Neil Cerutti

Re: How does python build its AST

2007-12-07 Thread MonkeeSage
On Dec 7, 9:50 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > > > A quick question about how python parses a file into compiled > > bytecode. Does it parse the whole file into AST first and then compile > > the AST, or does it build and comp

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread supercooper
On Dec 7, 8:15 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 14:34, supercooper <[EMAIL PROTECTED]> wrote: > > > > > On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > > I get the

module organization/inheritance problem

2007-12-07 Thread km
Hi all, I have a python module (M) with the following structure M (directory) | __init__.py (class Base(object) ...) | - a.py (class A(Base) ...) | - b.py (class B(Base) ...) | - c.py (class C(Base) ...) The __init_.py has a class which all the sub-modu

Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
Hello, >From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st 1901. For Example: the number 3566839 is 27.11.07 7:00. To calculate this in Excel I use this: ="01.01

Re: sqlite or xml

2007-12-07 Thread Paul Boddie
On 7 Des, 09:31, Kelie <[EMAIL PROTECTED]> wrote: > > Ah, now you're making it hard for me to decide again. :-) Talking > about comfortable, I do like Amara XML toolkit a lot. But I'll stick > with sqlite in this case. As a user of unfashionable XML technologies *and* relational database systems,

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Giles Brown
On 7 Dec, 13:20, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. > For Example: the number 3566

Re: File to dict

2007-12-07 Thread mrkafk
Duncan Booth wrote: > Just some minor points without changing the basis of what you have done > here: All good points, thanks. Phew, there's nothing like peer review for your code... > But why do you construct a dict from that input data simply to throw it > away? Because comparing strings for

Re: eclipse pywintypes.com_error

2007-12-07 Thread kyosohma
On Dec 7, 9:10 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Spindle wrote: > > I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i > > mentioned before, > > the problem happens only with eclipse and pydev,on the same machine i > > can run the script from command line or with IDLE wit

Re: Some python syntax that I'm not getting

2007-12-07 Thread Chris
On Dec 7, 2:31 pm, waltbrad <[EMAIL PROTECTED]> wrote: > > I understand how D['say'] gets you 5, But I still don't understand > the line after the 5. > > How is the character 's' some special code? And I don't get what is > going on with the % character. I'm used to it's use in c-style > formatt

Re: which configparse?

2007-12-07 Thread Sion Arrowsmith
Neal Becker <[EMAIL PROTECTED]> wrote: >I've looked at configparse, cfgparse, iniparse. > >configparse looks like what I want, but it seems last commit was >2years >ago. > >What is the best choice? ConfigParser is the battery included in the standard library. If you're planning on distributing yo

Re: Gnu/Linux dialogue boxes in python

2007-12-07 Thread kyosohma
On Nov 30, 7:55 am, Donn Ingle <[EMAIL PROTECTED]> wrote: > Hi, > Okay, so I am in the mood to try this: Inform the user about what modules > the app requires in a graphical dialogue that can vary depending on what > the system already has installed. (It will fail-to output on cli) > > I am runnin

Re: Python Class Best Practice

2007-12-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Dec 5, 12:18 am, Rod Person <[EMAIL PROTECTED]> wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> I've been doing python programming for about 2 years as a hobby and now >> I'm finally able to use it at work in an enterprise environment. Since >> I wi

Re: File to dict

2007-12-07 Thread Matt Nordhoff
Chris wrote: > Ta Matt, wasn't paying attention to what I typed. :) > And didn't know that about .get() and not having to declare the > global. > Thanks for my mandatory new thing for the day ;) :-) -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Erros when compiling a CPP program which uses CPython API functions

2007-12-07 Thread Christian Heimes
grbgooglefan wrote: > I am compiling CPP program which uses CPython API functions from > Python 2.5.1 source code > > First I compiled with this commanline, that time I got "pyconfig.h" > not found. On Unix you have to run ./configure and make before you can use a source tree. It creates a valid

Re: __iadd__ useless in sub-classed int

2007-12-07 Thread MonkeeSage
On Dec 7, 12:45 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <[EMAIL PROTECTED]> > escribió: > > > I've wondered about this myself. Seems to me, to prevent clobbering > > subclasses, __iadd__ (and all of the integer and float and whatever) > >

Re: Any simpler way to do this

2007-12-07 Thread Tim Golden
Lars Johansen wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": > x = term.GREEN > elif col

Re: Erros when compiling a CPP program which uses CPython API functions

2007-12-07 Thread grbgooglefan
On Dec 7, 2:17 pm, grbgooglefan <[EMAIL PROTECTED]> wrote: > On Dec 7, 12:32 pm, grbgooglefan <[EMAIL PROTECTED]> wrote: > > > > > > > I am compiling CPP program which uses CPython API functions from > > Python 2.5.1 source code > > > First I compiled with this commanline, that time I got "pyconfig

Re: File to dict

2007-12-07 Thread david
On Fri, 07 Dec 2007 16:46:56 +0100, Glauco wrote: > [EMAIL PROTECTED] ha scritto: >> Hello everyone, >> >> I have written this small utility function for transforming legacy file >> to Python dict: >> >> >> def lookupdmo(domain): >> lines = open('/etc/virtual/domainowners','r').readline

Re: Speed of Nested Functions & Lambda Expressions

2007-12-07 Thread Terry Jones
> "Duncan" == Duncan Booth <[EMAIL PROTECTED]> writes: Duncan> Terry Jones <[EMAIL PROTECTED]> wrote: >> Duncan Booth wrote: Duncan> You'll kick yourself for not seeing it. Duncan> If you changed fn_inner to: Duncan> def fn_inner(): Duncan> a, v = v, a Duncan> then you also changed 'a' and '

Re: sqlite or xml

2007-12-07 Thread Kelie
On Dec 6, 3:37 pm, [EMAIL PROTECTED] wrote: > If you're happy going with sqlite then stick with it. If on the other > hand you were considering XML because you're more comfortable with > that (e.g. you find XML easy to work with and you're more familiar > with XPath/XQuery than SQL) then you could

Re: Any simpler way to do this

2007-12-07 Thread Chris
On Dec 7, 10:37 am, Lars Johansen <[EMAIL PROTECTED]> wrote: > I have a function that looks like this: > > def Chooser(color): > > if color == "RED": > x = term.RED > elif color == "BLUE": > x = term.BLUE > elif color == "GREEN": >

Re: Dictionary instantiation?

2007-12-07 Thread Matt_D
On Dec 7, 11:42 am, Virgil Dupras <[EMAIL PROTECTED]> wrote: > On Dec 7, 9:05 am, Matt_D <[EMAIL PROTECTED]> wrote: > > > > > Hello there, this is my first post to the list. Only been working with > > Python for a few days. Basically a complete newbie to programming. > > > I'm working with csv modu

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
Spindle wrote: > I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i > mentioned before, > the problem happens only with eclipse and pydev,on the same machine i > can run the script from command line or with IDLE without any errors. Well, that's bizarre then. Hopefully someone else

Re: How does python build its AST

2007-12-07 Thread Kay Schluehr
On Dec 7, 3:23 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > A quick question about how python parses a file into compiled > bytecode. Does it parse the whole file into AST first and then compile > the AST, or does it build and compile the AST on the fly as it reads > expressions? (If the former case

Re: File to dict

2007-12-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > >> The csv module is your friend. > > (slapping forehead) why the Holy Grail didn't I think about this? If that can make you feel better, a few years ago, I spent two days writing my own (SquaredWheel(tm) of course) csv reader/writer... before realizing there was

Re: Gnu/Linux dialogue boxes in python

2007-12-07 Thread Jorgen Grahn
On Sun, 02 Dec 2007 17:18:45 +0200, Donn Ingle <[EMAIL PROTECTED]> wrote: >> But why?  Either >> >> (a) your program has a GUI and can display a dialogue box by itself >> (b) your program has a GUI but has problems opening even a tiny part >> of it (missing modules?), and should output diagnostics

Re: Speed of Nested Functions & Lambda Expressions

2007-12-07 Thread Duncan Booth
Terry Jones <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > >> You can use Python's bytecode disassembler to see what actually gets >> executed here: >> >> >>> def fn_outer(v): >> a=v*2 >> def fn_inner(): >> print "V:%d,%d" % (v,a) >> >> fn_inner() >> >> >>> import

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Dirk Hagemann
On 7 Dez., 16:50, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > On 7 Dez., 16:21, Tim Golden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Dec 7, 7:20�am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > >> Hello, > > > >> From a zone-file of a Microsoft Active Directory integrate

Re: eclipse pywintypes.com_error

2007-12-07 Thread Tim Golden
gurkan wrote: > i have treid the script : > > #import active_directory > import win32com.client > > win32com.client.Dispatch ("ADODB.Command") > #me = active_directory.find_user () > > #print me > > again i got the error : > > Traceback (most recent call last): > File "H:\dev\eclipse\workspa

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread supercooper
On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > Hello, > > From a zone-file of a Microsoft Active Directory integrated DNS server > I get the date/time of the dynamic update entries in a format, which > is as far as I know the hours since january 1st 1901. > For Example: the number 35

Re: ftplib.nlst gives error on empty directory

2007-12-07 Thread Giampaolo Rodola'
On 7 Dic, 10:42, loial <[EMAIL PROTECTED]> wrote: > Trying to use ftplib.FTP.nlst() method to list the files in > a directory on a FTP server. > > It works fine except when there are no files in the directory. Then it > gives the error > > ftplib.error_perm: 550 No files found. > > How can I handl

Re: python and a 2 gigs Usb Stick (pure pythonic stick)

2007-12-07 Thread Tim Chase
> i've received for my birthday two usb key, and i had the idea to make > the 2GB one a special python usb key. > So far i've put on it : > Movable Python > My Python directory > Iron Python > Jython > Instant django > > the file installation for : > Python , iron python , jython , PIL , Pygame ,

Re: File to dict

2007-12-07 Thread Chris
On Dec 7, 1:31 pm, [EMAIL PROTECTED] wrote: > Hello everyone, > > I have written this small utility function for transforming legacy > file to Python dict: > > def lookupdmo(domain): > lines = open('/etc/virtual/domainowners','r').readlines() > lines = [ [y.lstrip().rstrip() for y i

Re: File to dict

2007-12-07 Thread mrkafk
Glauco wrote: > cache = None > > def lookup( domain ): > if not cache: >cache = dict( [map( lambda x: x.strip(), x.split(':')) for x in > open('/etc/virtual/domainowners','r').readlines()]) > return cache.get(domain) Neat solution! It just needs small correction for empty or ba

Open Source Symposium CFP ending soon

2007-12-07 Thread Jeremy Fluhmann
Just a reminder that there's only one week left for the Open Source Symposium Call For Participation! http://www.texasoss.org/cfp (Deadline is December 15th) If you've been considering submitting, but aren't sure, I encourage you to go ahead and submit! I know several of you present at your user

Re: weird embedding problem

2007-12-07 Thread DavidM
On Fri, 07 Dec 2007 00:53:15 -0800, Graham Dumpleton wrote: > Are you actually linking your C program against the Python library? Yes. Refer OP: >> I'm embedding python in a C prog which is built as a linux shared lib. >> The prog is linked against libpython, and on startup, it calls >> Py_Initi

Re: File to dict

2007-12-07 Thread Chris
Ta Matt, wasn't paying attention to what I typed. :) And didn't know that about .get() and not having to declare the global. Thanks for my mandatory new thing for the day ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to browse a C Library with Python

2007-12-07 Thread georg.heiss
On 5 Dez., 21:03, "Rafael Sachetto" <[EMAIL PROTECTED]> wrote: > This could be a solution > > import commands > > callables = commands.getoutput("nm -D /lib/libc.so.6 | egrep ' T ' > ").split("\n") > callables = [c.split()[2] for c in callables] > > print callables > > On Dec 5, 2007 5:26 PM, Rafae

Who is Jesus?

2007-12-07 Thread aassime abdellatif
Who is Jesus? Without a doubt, you have often heard the claim that Jesus is God, the second person in the "Holy trinity." However, the very Bible which is used as a basis for knowledge about Jesus and as the basis for doctrine within Christianity clearly belies this claim. We urge you to consult y

Python 3.0a2 is out

2007-12-07 Thread Christian Heimes
A new alpha of Python 3000 was released a few minutes ago! http://www.python.org/download/releases/3.0/ Have fun and don't forget to report bugs at http://bugs.python.org/ Christian signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting Excel time-format (hours since 1.1.1901)

2007-12-07 Thread Boris Borcic
Dirk Hagemann wrote: > (3566839/24)/365 = 407 - YES I did this calculation too and was > surprised. But if you try this out in MS Excel: > ="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put > 3566839 in field A1 and switch the format of the result-fieldby right- > click on it to

changing fonts?

2007-12-07 Thread jyoung79
This is probably a silly question, but alas, I'll ask it anyway... Is it possible with Python, to change the font of the text returned in the Terminal Window in OS X? For example, lets say I'm running a Python program in Terminal, and it asks me "Please enter an English word to be changed to G

Re: Calculate an age

2007-12-07 Thread Pierre Quentel
On Dec 7, 7:09 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > How many days in a year? 365.25 (J2000 epoch), 365.2422 [as I > recall](B1900 epoch), 365.0 (non-leap year), 366 (leap year)? Gregorian > or Julian calendar -- and depending upon one's country, the Gregorian > reform may tak

  1   2   >