Re: how to config a comserver in a customize dll?

2005-05-22 Thread Tim Roberts
'SplitString' ] >_reg_progid_ = "TestPythonCom.Application" ># NEVER copy the following ID ># Use "print pythoncom.CreateGuid()" to make a new one. >_reg_clsid_ = "{93D78ABA-1F6C-4B1C-97C7-C3700511415A}" > >def SplitString(self, val): >

Re: reg mail sending without smtp module

2005-05-14 Thread Tim Roberts
o out in a very small number of ways. On a Unix system, you can use SMTP, or you can call /usr/sbin/sendmail directly. On Windows, you can use SMTP, or you can use MAPI. There is no "magic" sink into which you can pour e-mail. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Bo

Re: Problems with csv module

2005-05-14 Thread Tim Roberts
he canonical csv application. It can read a UCS-16 csv file, but it mishandles it. It doesn't split at the commas. It treats each line as a single cell. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: If you use PayPal you might consider an alternative

2005-05-04 Thread Tim Roberts
s: > >www.greenzap.com/benefits That web zite iz juzt too cutezy. I could never truzt it, even if I hadn't learned about it through a newzgroup zpam. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

ADODB Currency type broken in Python win32?

2005-04-26 Thread Tim Roberts
myMoney 6 (0, 25L) Instead, we get: myMoney 6 (0, -1794967296) The value has wrapped at 2**31. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting into Python, comming from Perl.

2005-04-26 Thread Tim Roberts
me to >jump ship (to mix my metaphors). That is truly wonderous. Are you famliar with the phrase "jumping the shark"? This chart might prove that, with Perl 6, Perl has now "jumped the shark". -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-16 Thread Tim Roberts
I'm >planning to put the contents of UnxUtils.zip in a directory and then move >the contents of UnxUpdates.zip, which has many of the same filenames, to >the same directory. Should I just let Windows replace the old files with >the updated ones? Yes. -- - Tim Roberts, [EMA

Re: Compute pi to base 12 using Python?

2005-04-16 Thread Tim Roberts
t, even not a >># pi-sonnet, but it surely produces Pi! > >It sure does. When I ran it my jaw dropped. I had 7,947 CORRECT digits in >2 minutes 0 seconds (by my stopwatch)! How do you know? I think the 7,912th digit is wrong. ;) -- - Tim Roberts, [EMAIL PROTECTED] Providenza &

Re: Global Variables

2005-04-13 Thread Tim Roberts
It means that your function has "side effects" beyond just returning a value or set of values. This kind of thing is a better solution: def change_filename(): return raw_input() def change_path() return raw_input() filename = change_filename() path = change_path() -- -

Re: Https Form Page

2005-04-09 Thread Tim Roberts
>http=httplib.HTTP("https://www.abc.com/",443) If you want https, you should use the HTTPS class. http = httplib.HTTPS("https://www.abc.com/",443) Or, even better, the HTTPSConnection class. http://www.noah.org/python/https/ -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: change extensions

2005-04-07 Thread Tim Roberts
"Bob Then" <[EMAIL PROTECTED]> wrote: >how can i change all files from one extension to another within a direcory? In Windows, the quickest way is: os.system( "rename *.old *.new" ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -

Re: urllib problem (maybe bugs?)

2005-04-01 Thread Tim Roberts
't do that. It always sends plain old application/x-www-form-urlencoded data. I think you're going to have to roll your own sender. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex string into binary format?

2005-04-01 Thread Tim Roberts
;i1 = binascii.unhexlify(s1) >i2 = binascii.unhexlify(s2) >x = i1 ^i2 > > TypeError: unsupported operand type(s) for ^: 'str' and 'str' No imports at all: s1 = '1C46BE3D9F6AA820' s2 = '8667B5236D89CD46' i1 = int(s1,16) i2 = int(s2,16) x =

Re: Newbie Shell Editor Question

2005-03-30 Thread Tim Roberts
I don't know IDLE, but it's probably something like File->Run. >>>> exit >'Use File/Exit or your end-of-file key to quit IDLE' >>>> print "Hello" >Hello THAT'S the way you use IDLE. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: File Uploads

2005-03-30 Thread Tim Roberts
ur problem solved, but you should know there is a problem with this line. The print statement automatically adds an end-of-line, so this will actually end up producing TWO blank lines after the header. You should use this: print "Content-type: text/html\n" -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-29 Thread Tim Roberts
ion did not really say "^L". It gave me the symbol for female, which is code point 12 in the default character set. I translated it to the VIM equivalent to make the point.) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: html tags and python

2005-03-26 Thread Tim Roberts
t; much quicker. To do that with your code, I have to type "m tab 2 2 2 2 2 2 tab 2005". As an alternative, there are Javascript-based mini-calendars you can download that popup a little window with the current month, and let you click on the date. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping code by indentation - feature or ******?

2005-03-26 Thread Tim Roberts
st of 1,000+ evils." Or, paraphrasing Mark Twain, "Python is the worst possible programming language, except for all the others." -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: float default formatting

2005-03-26 Thread Tim Roberts
ef="+FLT) % (3.0,4.5) Are you trying to do currency? There are better ways, using the locale methods. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Twisted version 2.0

2005-03-26 Thread Tim Roberts
be answered with a 4-line application using Twisted, but now it's grown even more? Remember the Master Control Program from Tron? I think of Twisted as Python's MCP. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: DBAPI Paramstyle

2005-03-26 Thread Tim Roberts
that the database provider inserts whatever quoting is required; you don't have to remember to put single quotes around the arguments, and protect single quotes within the arguments by doubling them, and so on. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing the value of a for loop index on the fly

2005-03-23 Thread Tim Roberts
; is just a normal function that creates the list [0,1,2,3,4]. The "for" statement keeps running the loop until it runs out of values in that list or tuple. So, you CAN change the value of i, but it won't change the operation of the loop. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: possible bug?

2005-03-23 Thread Tim Roberts
C:\\Program Files\\WinRK\\WinRK.exe -create ' + or Command_String = r'C:\Program Files\WinRK\WinRK.exe -create ' + -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: inline comparison

2005-03-19 Thread Tim Roberts
get around wtih this? I don't want to break down this >comparison in two steps. Sorry, you have to. Assignment statements are not expressions in Python. m = self.macro_parser.match(d) if m: xxx You know the outer parentheses are not necessary, right? -- - Tim Roberts

Re: Is Python like VB?

2005-03-17 Thread Tim Roberts
th a lot of customization using >Visual Basic. The VB in Microsoft Office is not being discontinued. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-16 Thread Tim Roberts
this: a = (3 + 5) * 5 You really, really want (3 + 5) to be an integer, not a one-item tuple. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 shell extension (virtual drive)

2005-03-15 Thread Tim Roberts
m Microsoft, and (C) no human being really wants to do. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: will it cause any problems to open a read-only file & not close it?

2005-03-15 Thread Tim Roberts
you open a file to read >& never close it? A file is closed when the last reference to it is deleted. Since you never save a reference to this file, the last reference is deleted as soon as the readlines() call finishes. So, the file will be closed when you move to the next stateme

Re: error sending path to Win OS

2005-03-15 Thread Tim Roberts
t exist from the point of view of the directory where the script is running this. You might do this: print os.getcwd() os.system('dir ' + InputDirectory) just to prove that you are where you think you are. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a problem on this simple code

2005-03-15 Thread Tim Roberts
n i make rx_command of type 'int' if i am to use 2)? Did you get an answer to this? I couldn't see any responses. The answer is either: rx_command = unpack('1B', rx_data_command)[0] or (rx_command,) = unpack('1B', rx_data_command) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: dictionary - howto get key value

2005-03-11 Thread Tim Roberts
get it in the python way ? If you need to do this a lot, just keep two dictionaries, where the keys in each are the values in the other. reversephone = dict( zip( phone.values(), phone.keys() ) ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie : prune os.walk

2005-03-11 Thread Tim Roberts
. The statement dir = [] does not actually change the list that was passed in. It creates a NEW empty list and binds it to "dir". If you want to empty the "dir" variable, try: del dir[:] -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up CGIHTTPServer

2005-03-07 Thread Tim Roberts
Server for Win98, although I think it's awfully hard to configure. thttpd and xitami are good lightweight web servers. Apache works quite well in Windows, but I don't think it is very happy on Windows 98. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 COM and data types / direction

2005-03-05 Thread Tim Roberts
as short:%d as int:%d sum:%d" % (inShort, inInt, outSum) > outSum = inShort + inInt > ># Add code so that when this script is run by ># Python.exe, it self-registers >if __name__=='__main_ _': > print "Registering COM server..." > import win32

Re: windows bat file question

2005-03-02 Thread Tim Roberts
rom logilab.pylint import lint >lint.Run(sys.argv[1:]) > > >DosExitLabel = """ >:exit >rem """ -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: os.stat('')[stat.ST_INO] on Windows

2005-03-02 Thread Tim Roberts
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >Tim Roberts wrote: >>>Are inodes supported on Windows NTFS, FAT, FAT32? >> >> No. Inodes are strictly a Unix filesystem concept. > >I disagree. NTFS MFT records are so similar to inodes >that thei

Re: os.stat('')[stat.ST_INO] on Windows

2005-03-01 Thread Tim Roberts
Patrick Useldinger <[EMAIL PROTECTED]> wrote: > >What does the above yield on Windows? 0. >Are inodes supported on Windows NTFS, FAT, FAT32? No. Inodes are strictly a Unix filesystem concept. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- htt

Re: Is it possible to pass a parameter by reference?

2005-02-26 Thread Tim Roberts
is lost. However, the variable zzz is still bound to [0,1,2]. If you need to create a new object and return it to the mainline, do that: def xxx(yyy): yyy = [ 3, 4, 5 ] return yyy zzz = [ 0, 1, 2 ] zzz = xxx(zzz) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boe

Re: cgi: getting at raw POST data?

2005-02-26 Thread Tim Roberts
x27;m not seeing how to get at data that's not a named form parameter. If you are using POST in some non-standard way, just skip using the cgi module at all and read stdin yourself. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Comm. between Python and PHP

2005-02-22 Thread Tim Roberts
u don't have to demean yourself by working in PHP. Sockets and pipe files are common methods of communicating with a daemon. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: A few q's on python files.

2005-02-22 Thread Tim Roberts
single file along with the interpreter. When the .exe is executed, it extracts the interpreter and the scripts into a temp directory, and fires up the interpreter. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in email package?

2005-02-20 Thread Tim Roberts
tioned, you probaby shouldn't assume it. >Can this behaviour of email be considered a bug? Not in my opinion, no. >Is there a good case to iterate over something useful in a message? Well, if you don't have an answer to that question, then why would you expect it to support it

Re: Help needed for to build a CGI shell interface.

2005-02-17 Thread Tim Roberts
o expose a command shell via CGI? Can you think of a better way to allow hackers to wreak havoc on your system? -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I make my program start fullscreen ?

2005-02-17 Thread Tim Roberts
BOOGIEMAN <[EMAIL PROTECTED]> wrote: > >os = windows xp >How do I make "myprogram.py" start fullscreen at windows command prompt ? >Also I made it as "myprogram.exe" with py2exe,but how to start fullscreen ? Which GUI toolkit are you using? wxPython? tk?

Re: image fourier transform

2005-02-14 Thread Tim Roberts
', then you do 1D FFTs on all the columns of X'. So, for a 32x32 2D FFT, you'll end up doing 64 1D FFTs. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Considering python - have a few questions.

2005-02-13 Thread Tim Roberts
e on-the-fly. With a package like CherryPy, you get a web server built-in. You fire up the server in the background, and bring up Internet Explorer as "your" user interface. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: dos box appears when clicking .pyc

2005-02-13 Thread Tim Roberts
S box. If you really want .pyc files to run without a DOS box, bring up a command shell and type assoc .pyc=Python.NoConFile (Actually, you should type "assoc .pyw" to make sure that is its file type.) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python mail filter

2005-02-08 Thread Tim Roberts
a procmail recipe can feed a message through a filter, and then pass the results of that filter back in to the e-mail system for further processing? It seems to me that you should consider letting procmail do what it is good at, and use your Python solution for the things that are beyond it. -- - T

Re: Converting a string to a function pointer

2005-02-06 Thread Tim Roberts
't overlook the simple (and possibly more secure) answer: lookup = { 'a': a, 'b': b, 'c': c, } if lookup.has_key(myFunction): return lookup[myFunction]() else: print "Couldn't find", myFunction -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter: Can You Underline More Than 1 Char In A Menu Title

2005-01-31 Thread Tim Roberts
I intend to actually have two separate keys invoke this menu >to have it behave differently in different circumstances. You can, of course, CHANGE the underlined character to match the circumstances. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why can't use cursor.nextset() in adodbapi package?

2005-01-25 Thread Tim Roberts
gt; > >>> crsr.nextset() If you are only issuing one SELECT, like most applications, then nextset() serves no purpose. If you did something like this: sql = "select * from wjtmp; select count(*) from wjtmp;" That's when you need nextset(). Personally, I've never used it. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: is there better 32 clock() timing?

2005-01-25 Thread Tim Roberts
on Windows? The ONLY way to get small-integer microsecond responses in Windows is to write a kernel driver, and even then there are no guarantees. Windows is NOT a real-time system. If you have an environment where an unexpected delay of a millisecond or more is going to cause damage, then you n

Re: getting file size

2005-01-22 Thread Tim Roberts
son I >should do both? When reading to the end of a file, won't tell() be just >as accurate as os.path.getsize()? On Windows, those two are not equivalent. Besides the newline conversion done by reading text files, the solution in 2. will stop as soon as it sees a ctrl-Z. If you used

Re: global variable, ok for string, bad for int

2005-01-21 Thread Tim Roberts
27;:1, 'deux':2} > >def print_value(): > print vardict['un'] ># ok, that works > > > >#!/bin/python >varint = 1 > >def print_value(): > print varint ># ok, that failed > >python 2.3.4

Re: Is there a library to parse Mozilla "mork" documents?

2005-01-20 Thread Tim Roberts
han the same file would be in, say, INI format. I wrote a Python script to parse it, but it isn't terribly robust. I was able to produce a dictionary, but I didn't do anything with the results. You're welcome to take a look: http://www.probo.com/timr/parsemsf.py -- - Ti

Re: Threading Or Other Suggestions?!?

2005-01-15 Thread Tim Roberts
s, I was thinking about threads... does anyone have other/better >suggestion(s)? Does anyone see any difficulty/memory problems in using >threads? Yes. Threads are used to run multiple parts of your own program. To run another program, you need to launch a new process. You can still monitor i

Re: from __future__ import decorators

2005-01-15 Thread Tim Roberts
Jacek Generowicz <[EMAIL PROTECTED]> wrote: > >I have some code, which makes copious use of the @decorator syntax I'm very curious to know what kind of application you are writing in which "copious use of the @decorator syntax" actually solved a problem productively

Re: why are people still using classic classes?

2005-01-13 Thread Tim Roberts
ill no compelling reason to break the old habits and type those 6 extra characters. Once a person has a case where the new classes make a difference, I suspect they catch the new habit and never look back. I haven't crossed that threshhold yet. -- - Tim Roberts, [EMAIL PROTECTED] Providenza &

Re: Octal notation: severe deprecation

2005-01-13 Thread Tim Roberts
le that the creation and destruction of an object might have useful side effects. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting rid of "self."

2005-01-09 Thread Tim Roberts
elf): exec(magic()) print hi hi = "baby" print hi def other(self): exec(magic()) print hi a = A() a.meth() a.other() That's way too fragile to be useful. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: smtp question

2005-01-06 Thread Tim Roberts
. Everything else, including the From: and To: lines, will be taken as part of the message body. I assume you meant to use \r\n, but \n will work just as well and is less error prone. >print "Message length is " + repr(len(msg)) Easier is: print "Message length is", len(msg) More efficient is: print "Message length is %d" % len(msg) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on Linux

2004-12-28 Thread Tim Roberts
27;t want to uninstall the old version. Red Hat installs packages that are needed for its configuration scripts. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Upgrading Python Article

2004-12-18 Thread Tim Roberts
JanC <[EMAIL PROTECTED]> wrote: >Tim Roberts schreef: > >> I don't think that's fair. Visual C++ 7.1 is signficantly better at >> compliance than their past compilers. > >AFAIK that's only for C++, not for C...? Yes. Microsoft has largely chosen t

Re: Python compiler method

2004-12-16 Thread Tim Roberts
e compiler of the python.thanks a lot!!! Perhaps you could ask your question in a different way. Python is designed as an interpreted language, like Perl and Javascript. It isn't compiled to machine language. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. --

Re: Upgrading Python Article

2004-12-11 Thread Tim Roberts
sual C++ 7.1 is signficantly better at compliance than their past compilers. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Time for : comp.lang.python.newbies ??

2004-12-06 Thread Tim Roberts
n't, really. I don't think the percentage of true newbie questions has really gone up. However, as you grow more knowledgeable, the percentage of questions that SEEM like newbie questions goes up. comp.lang.python has always been a bastion of kindness and tolerance in the comp.lang hi

Re: Delphi/Kylix and Python

2004-12-04 Thread Tim Roberts
My problem with both Delphi and Kylix is in getting them to connect >with PostgreSQL and SQLite. Any suggestions? From what I have read, ODBC or >JDBC may do it, but I have experience with neither. There are direct Delphi components for both databases. Google is your friend. -- - Tim Ro

Re: ver 23 invokation on Windows

2004-11-30 Thread Tim Roberts
script gets invoked, but command line arguments disappear. >Any idea what to do? Did you remember to pass the parameters when you created the file association? C:\TMP>assoc .py .py=Python.File C:\TMP>ftype Python.File Python.File=C:\Apps\Python23\python.exe "%1" %* C:\TMP> --

<    5   6   7   8   9   10