Re: [Tutor] tuples versus lists

2006-09-14 Thread Tim Johnson
eturn multiple values from a function using tuples. > > Why would you use one in preference to the other? I use tuples as above and where I don't want data changed... tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com __

Re: [Tutor] pymssql or ODBC

2006-09-15 Thread Tim Golden
[Chris Hengge] | Does anyone know how to make pymssql use windows authentication? I'm fairly sure, from previous experience and a brief perusal of the source, that pymssql doesn't offer the possibility of pass-through authentication. When I use it, I have to ask my DBA to set up a specific user.

Re: [Tutor] pymssql or ODBC

2006-09-15 Thread Tim Golden
| Does anyone know how to make pymssql use windows authentication? | | Also, can anyone point me to a simple ODBC guide for SQL? OK, bit of a summary. If it's not answering your questions, hopefully it'll answer someone else's! 1) mxODBC [http://www.egenix.com/files/python/mxODBC.html] NB: Ne

Re: [Tutor] Problems serving up PDF

2006-09-16 Thread Tim Johnson
es > to succeed. Imitation is the sincerest form of flattery. thanks. that is a very helpful tool. and I'm seeing that headers are consistant with what I've sent. Good tip! tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com __

[Tutor] Paramstyle/sql injection [was Python CGI Script]

2006-09-20 Thread Tim Johnson
that (if I understood him correctly) that the programmer is required by perl to use the 'prepare' function in the perl DBI prior to sending a select statement. If not done (again, if I understood him correctly) an exception is thrown. Is this correct? Now I'm off to wri

Re: [Tutor] Can my code be optimized any further (speed-wise)?

2006-10-08 Thread Tim Peters
[Geoframer] > The last few days i've been learning python and have been doing this by > trying to solve problems for a programming competition. I assume you're talking about: http://www.spoj.pl/problems/FCTRL/ If so, you'll note that I'm tied for the fastest Python solution there ;-) The /g

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Tim Peters
[Dick Moores] ... > I'm thinking that just for the hell of it I could use urandom() as a > source of random decimal digits. You could, yes. > Or in a coin tossing program. Here's a list of 7817 '1's and 0's > generated by urandom(): Note that the length of the list will vary from run to run. Si

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Tim Peters
[Dick Moores] >>> Would this be a better random source than choice([0,1]), which uses >>> random()? [Tim Peters] >> "Better" as measured against what criteria? [Dick] > I meant would it be closer to true randomness than random(), even if > much slower? D

Re: [Tutor] What are these things urandom() returns?

2006-10-11 Thread Tim Peters
[Tim Peters] >> If you want /true/ randomness, you can buy a certified hardware random >> number generator, based on non-deterministic physical processes (like >> timing radioactive decay, or measuring thermal noise). [Terry Carroll] > Why buy when you can borrow?: Speed

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Tim Peters
[Chris Lasher] > My professor and advisor has been "inspired" by me to give Python a > try. He's an avid Perl user, and challenged me with the following: > > What is the Python equivalent to perl -e ''? The initally attractive but unsatisfying answer is: python -c '' The reason it's "unsatis

Re: [Tutor] an alternative to shutil.move()?

2006-10-16 Thread Tim Golden
| Alfonso <[EMAIL PROTECTED]> wrote: | | > Is there an alternative in python to use shutil.move()? | > | > It copies the files and then removes the source file insted of just | > moving directly the file (don't know much about file systems, but I | > suppose that when you move using the shell,

[Tutor] is gotchas?

2006-11-06 Thread Tim Johnson
I've been using python is 1.5* but haven't used `is` that much. 1)where do `is` and `==` yield the same results? 2)where do they not yield the same results? 3)is there a special method for `is'. 4)Pointers to docs are welcome. thanks tim -- Tim Johnson <[EMAIL PROT

Re: [Tutor] (OT) Flame wars

2006-11-06 Thread Tim Johnson
the language in a way that only Lisp > and Tcl have really been good at up till now. > Sorry Alan, but you are leaving out rebol. Command structures in rebol are are just functions and IMHO, easier to "roll your own" than lisp macros. But with freedom comes responsibi

Re: [Tutor] is gotchas?

2006-11-06 Thread Tim Johnson
nd evaluate to False when the assigned value is more that 1 byte? I think I ran into this before and that's why I never used `is'. Good thread. Beats flame wars. thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] comparing languages [was (OT) Flame wars]

2006-11-07 Thread Tim Johnson
* Alan Gauld <[EMAIL PROTECTED]> [061107 01:02]: > > "Tim Johnson" <[EMAIL PROTECTED]> wrote > >> allows us to embed loops and all sorts, effectively adding new > >> command structures to the language in a way that only Lisp > >> and Tcl hav

Re: [Tutor] Ruby Code Blocks vs. Python Lambdas

2006-11-07 Thread Tim Johnson
had a table full of Pythonistas. > > And Andreas, Danny and I also argued for Ruby. > And elsewhere Tim making a case for Rebol. > > It just strikes me as interesting that on a Python oriented mailing > list we have people arguing in defence of other languages! This > is n

Re: [Tutor] Request - please join the list to post

2006-11-09 Thread Tim Johnson
Thank you, > A list admin who has other things he would really rather do... > Kent > > > _______ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-in

Re: [Tutor] [spam-spf] Re: Request - please join the list to post

2006-11-09 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [061109 07:46]: > Tim Johnson wrote: > > On a related note, every time I post, I get some kind of advisory > > email back that is worded as if this is the first time I've posted. > > (I've been on this list for close to 6 ye

Re: [Tutor] free IDE for Python?

2006-11-14 Thread Tim Johnson
etc. I've used vim in the past for python and recommend it for ease of use and support. I also use emacs, which may be found harder to learn but has the advantage of being able to evaluate code directly in the editor. tim > - matt > > > On 11/13/06, Mi

Re: [Tutor] free IDE for Python?

2006-11-14 Thread Tim Johnson
* William O'Higgins Witteman <[EMAIL PROTECTED]> [061114 09:05]: > On Tue, Nov 14, 2006 at 12:28:02PM -0500, Richard Querin wrote: > > On 11/14/06, Tim Johnson <[EMAIL PROTECTED]> wrote: > > > > I've used vim in the past for python and recommend

Re: [Tutor] Alternatives to PY2EXE

2006-11-16 Thread Tim Golden
[Chris Hengge] | Because alot of the users here at Intel dont want to admit | you can write usable programs in a "scripting" language.. so | when they see a .exe they feel comfy... One option which could help there -- although your other considerations might outweigh it -- is Fredrik Lundh's e

Re: [Tutor] Alternatives to PY2EXE

2006-11-16 Thread Tim Golden
[Chris Hengge] | It really does boggle my mind how people can be so wierd when | asked to run something that isn't a .exe... Guess its a | side-effect of the windows generation. I know exactly what you mean. I had to convince a project manager once to use Python (in some small, out-of-the-way

Re: [Tutor] A Million Sevens

2006-11-17 Thread Tim Peters
[Thomas] > Earlier today I typed the following into my pythonwin interactive > interpreter in windows xp: > > >>> int('7' * 10 ** 6) > > I expected either an error message Unlikely, if your box has enough RAM to run WinXP :-) > or it to get stuck and require me to stop the process manually. Not

Re: [Tutor] I need SOAPpy documentation.....

2006-11-22 Thread Tim Golden
| Can some one provide me with the SOAPpy documentation; I mean | a kind of list of the functions available in the module and | the details of those functions. Come on, you can try harder than that. Have you downloaded SOAPpy? Where did you get it? If it came with your distro, Google and Feel Lu

Re: [Tutor] I need SOAPpy documentation.....

2006-11-22 Thread Tim Golden
| Can some one provide me with the SOAPpy documentation; I mean | a kind of list of the functions available in the module and | the details of those functions. As a general rule, you can run your own local pydoc server, which will offer HTML docs on every module you have installed: python -m py

Re: [Tutor] IIS and Virtual directories

2006-11-23 Thread Tim Golden
| I have been trying to figure out how to create an IIS Virtual | Directory through Python but can't find anything that works. | I have done it in the past with Perl with the script below | but can't seem to figure out how to do it in Python. I was | wondering if someone could point me in the r

Re: [Tutor] (no subject)

2006-11-24 Thread Tim Golden
[Gardner, Dean] | I was wondering if anyone knew how to control the desktop | resolution via python. I have investigated pygame which seems | to allow you acces to video settings but it appears to only | influence a window rather than the system (I may be totally | wrong about this though) |

Re: [Tutor] (no subject)

2006-11-24 Thread Tim Golden
[Gardner, Dean] | I was wondering if anyone knew how to control the desktop | resolution via python. | | What I ideally need is a small app that will swap resolution | between 1600*1200 and 1280*1024 OK. Had a bit of time to look into this. The following code snippet is (hopefully) fairly se

Re: [Tutor] cursor.description

2006-11-24 Thread Tim Golden
[Antonios Katsikadamos] | Hi all. I am new to python and i am trying to execute queries | from postgres db. I have a question. | | What is exactly the operation of cursor.description? Ultimately, the doc you want to look at is this: http://www.python.org/dev/peps/pep-0249/ Here's the relevan

[Tutor] How to Automatically generate a synopsis for a Module

2006-11-27 Thread Tim Johnson
script as a string so that I can print to stdout. IOWS: I want to extract what help(module) would display in the python interpreter. Any ideas? :-) TIA tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___

Re: [Tutor] How to Automatically generate a synopsis for a Module

2006-11-27 Thread Tim Johnson
Amazing what google can do I think pydoc does it all... pydoc -p 1234 sets up the server what what I need. Never mind! :-) tim * Tim Johnson <[EMAIL PROTECTED]> [061127 17:24]: > Hello: > If I start the python interpreter, then import a file, and > type > hel

Re: [Tutor] Does Fredrik Lundh's console module work on Win XP?

2006-11-28 Thread Tim Golden
[Dick Moores] | This seems it might be very useful. I just downloaded and thought I'd | installed "console-1.1a1-20011229.win32-py2.5.exe" in Python 2.5 in | Win XP, but I can't get it to appear. | | My attempts: | === | E:\Python25\Lib\site-packages>Console

Re: [Tutor] Rounding a float to n significant digits

2006-11-30 Thread Tim Peters
[Dick Moores] > ... > But isn't there a PRECISE answer to my question? Of course ;-) > Or is it OT? Well, it's really more a question about your machine's floating-point hardware than about Python. Good explanations of exact limits for IEEE-754 floating-point hardware can be found many places o

Re: [Tutor] How to kill an app from python on windows?

2006-12-04 Thread Tim Golden
[Paulino] | To launch an app one can state os.startfile('hello.pdf') and | the file is opened in acrobat . | | And how can I kill the app from python, in order to, for | instance, rename the file? | | Is it possible? This link may get you started: http://effbot.org/pyfaq/how-do-i-emulate-os-

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Tim Golden
| Struggling with python & XP again. My app needs to know if a | certain program is running on my XP box As a complete alternative, consider using WMI: import os, sys import wmi c = wmi.WMI () for process in c.Win32_Process (Name="excel.exe"): print "Excel is running" break else: print "

Re: [Tutor] How to kill an app from python on windows? (Tim Golden)

2006-12-06 Thread Tim Golden
[Tim Golden] | > This link may get you started: | > | > http://effbot.org/pyfaq/how-do-i-emulate-os-kill-in-windows.htm | > | > although it may not apply, depending on the exact | > circumstances of what you're doing. [Paulino] | Thank you Tim, | | How do i get the pid of

Re: [Tutor] XP & catching execl o/p ?

2006-12-06 Thread Tim Golden
[Dave S] | Just looked at WMI - didn't know it existed ! | Am going down the subprocess route first as its 'built in'. | If that does not work - hello WMI Personally, I find having both (and other) tools in my toolbelt useful -- I've just answered another question elsewhere about starting and st

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Tim Golden
[Toon Pieton] | As soon as I start the program, I get a error: | win32com.client not found. This - of course - leads to the | conclusion that I don't have the win32com module installed. I | tried to find it (Google), but all I could find when | searching for "python win32 module (download)", I

Re: [Tutor] Q: win32 download (attack of the newbies)

2006-12-06 Thread Tim Golden
[Kent Johnson] | Tim Golden wrote: | > Using win32com and Excel is very easy, but there | > are alternatives if you want: | > | > http://cheeseshop.python.org/pypi/xlrd/0.5.2 | | xlrd is for reading only - OP wants to write Excel files. Oops! Quite right. I was moving a bit too

Re: [Tutor] Opening a pdf on a certain page

2006-12-12 Thread Tim Golden
[Toon Pieton] | Is there anyway to open a .pdf at a certain page? Been | searching the internet, but couldnt find anything. Pretty certain there isn't. Even if you'd generated the PDF yourself and set an internal anchor there doesn't seem to be a URI which will jump to that point. I'd be really

Re: [Tutor] getting all txt files in a folder

2006-12-12 Thread Tim Golden
[Toon Pieton] | Is there any way to get all the txt files in a certain folder | and all of its "sub"-folders? With sub-folder I mean all the | folders inside the previously found folder. Any help would be | greatly appreciated Have a look at os.walk and fnmatch TJG _

Re: [Tutor] User identification and running in the background.

2006-12-12 Thread Tim Golden
| I've had a quick scan around and can't find a way to identify the user | who is logged in on the machine while a script is running? I've seen a | few mentions of it being possible using bits of the win32 library but | I would have liked my software to be portable with no adjustments. | | How can

Re: [Tutor] Opening a pdf on a certain page

2006-12-12 Thread Tim Golden
[Dave Kuhlman] | On Tue, Dec 12, 2006 at 04:00:29PM -, Tim Golden wrote: | > [Toon Pieton] | > | > | Is there anyway to open a .pdf at a certain page? Been | > | searching the internet, but couldnt find anything. | > | > Pretty certain there isn't. Even if you&

Re: [Tutor] Confusing Unicode Conversion Problem.

2006-12-13 Thread Tim Golden
[Chris Hengge] | 'ascii' codec can't encode character u'\xa0' in position 11: | ordinal not in range(128) | Error with: FRAMEMRISER of type: | Excel Row : 6355 OK. Let's get to the basics first: import unicodedata print unicodedata.name (u'\xa0') # outputs: NO-BREAK SPACE So somewhere (ma

[Tutor] Confusing Unicode Conversion Problem.

2006-12-13 Thread Tim Golden
[Chris H] > The reason I an forcing each line to string and splitting it is because the > pure numeric values coming from the excel sheet all come in a decimal, and > have an appended .0 at the end. Ah! You're using str to convert a number to a string. I see. And you're relying on the fact that

Re: [Tutor] wrapping a command line tool

2006-12-15 Thread Tim Golden
> I am using a command line tool that allows me to specify a serial > port and either read from or write data to it. I would like to create > a python module that wraps that functionality and allows me to > manipulate the incoming data to present it in a table for instance > (like top works) or may

Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Tim Golden
Chris Hengge wrote: > I hope this is related enough for this thread, but I'm curious why > people didn't seem to unanimously jump into 2.5 upon release. Python > seems very good about holding its backward compatibility vs some other > languages I've dealt with like C# that seems to require appli

Re: [Tutor] XML-RPC data transfers.

2007-01-01 Thread Tim Golden
Chris Hengge wrote: > Going off your thoughts that I'm asking to do something outside the > realm of the readers here, is there a better place to ask this kind of > oddball stuff? I've looked around and haven't been able to find any > support for XML-RPC (might be a good sign to drop it and move

[Tutor] Apologies...

2007-01-08 Thread Tim Golden
... my many apologies to the readers of the tutor list. I went away for a week without suspending delivery just as my company changed name - and decided to send an irritating response to anything directed at the old name. The list admin has very properly unsubscribed the old address (otherwise you'

Re: [Tutor] Best IDE for Python

2007-01-25 Thread Tim Johnson
o > auto-completion that shows a list of possibilities. Komodo Edit is free > and Komodo IDE cost some $$. IMHO: If one programs in more than one programming language, the ultimate would be an editor/IDE that can accommodate all with similar functionality and beh

[Tutor] site-packages and permissions to byte-compile

2007-01-29 Thread Tim Johnson
MySQLdb files are being byte-compiled. Their ownership is root:root and permissions are 644 I've set the same ownership and permissions for the other files to same. What do I need to do to insure that they are byte-compiled? Thanks Tim ___ Tutor mai

Re: [Tutor] site-packages and permissions to byte-compile

2007-01-29 Thread Tim Johnson
On Monday 29 January 2007 03:17 pm, Dave Kuhlman wrote: > On Mon, Jan 29, 2007 at 01:35:22PM -0900, Tim Johnson wrote: > > Hello: > > > > I just installed python 2.5 on Linux/Slackware 10.0 > > > > I have placed three files in the root of site-packages > > o

Re: [Tutor] Printing txt files in landscape from python

2007-02-01 Thread Tim Golden
> Hi All, > > do you have any idea, how I can send a txt file to the default printer in > landscape view with python on windows. > I wanted to set up just the char size and the orientation of the printout. > > thinking about > os.system('notepad.exe /pt "%%%s"' % filename) Doesn't complete

[Tutor] Using __import__ and byte-compiling

2007-02-05 Thread Tim Johnson
odule.py) then compile module.py else ## module.pyc does not exist compile module.py ## Or is there a python asset that handles this? cheers tim -- Tim Johnson <[EMAIL PROTECTED]> ___ Tutor maillist - Tu

Re: [Tutor] Using __import__ and byte-compiling

2007-02-05 Thread Tim Johnson
I should add one thing: If the source module is in the same directory, it *is* byte-compiled. thanks tim On Tuesday 06 February 2007 03:46 pm, Tim Johnson wrote: > I am currently using the __import__ function to do > conditional importing of modules, whose names are determined > at runtim

Re: [Tutor] python24dll not found

2007-02-07 Thread Tim Golden
[... snip slightly complex problem involving different versions of Python and possibly mismatched module imports ...] > Now all my programs, including the new one, are working again. I have no > clue what caused this. I've searched Google but I can't find a hit similar > to my configuration and si

[Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Tim Johnson
you think? regards -- Tim Johnson <[EMAIL PROTECTED]> Palmer, Alaska, USA ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Tim Johnson
On Wednesday 07 February 2007 09:34 pm, Bob Gailer wrote: > Tim Johnson wrote: > > Nope, I'm not criticizing the writing or the technical info at... > > Just the sloppy publishing. > > > > I ordered the Reference Manual for Version 2.5 and got Version 2.3 > &

Re: [Tutor] Problem with Reference Manual (duplicate ISBN)

2007-02-07 Thread Tim Johnson
thanks tj -- Tim Johnson <[EMAIL PROTECTED]> Palmer, Alaska, USA ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python referrence

2007-02-09 Thread Tim Johnson
;server" as pydoc -p 1234 & (where 1234 is the non-conflicting port number of your choice) And then point my browser to http://localhost:1234 (subsititute your port number) This will pick up your own docstrings, libraries and classes as well as the installed python system. -- Tim Johns

Re: [Tutor] A doxygen-like tool for Python ?

2007-02-11 Thread Tim Golden
Christopher Arndt wrote: > Hilton Garcia Fernandes schrieb: >> Dear all, >> >> i've been using doxygen for quite a time to document softwares written in >> C and C++, but could not found a similar tool for Python software. >> >> Could you please point me to a suitable tool ? > > How about http://e

Re: [Tutor] Convert my .bat and .vbs to .py

2007-02-15 Thread Tim Golden
Mark Bystry wrote: > The first things that I want to learn is how to do basic stuff like copying, > moving, and deleting > files around from folder to folder. I have been in the help section of python > (copyfile section) > but I do not understand what I am doing wrong. Welcome to Python. You

Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Tim Golden
Alan Gauld wrote: > But its obvious there are two views at work here. (The one which sees an apostrophe in "it's" and the one which doesn't? ;) But, joking aside, I think you've summarised the situation quite well, and I suspect that -- given the what must be thousands of mailing lists and newsgr

Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Tim Golden
Tim Golden wrote: > Alan Gauld wrote: >> But its obvious there are two views at work here. > > (The one which sees an apostrophe in "it's" and the > one which doesn't? ;) > > But, joking aside, I think you've summarised the situation > quit

Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Tim Golden
Kent Johnson wrote: > Tim Golden wrote: >> field and [EMAIL PROTECTED] in cc: My problem there is that I usually >> don't want to send the originating individual a private copy >> of an email he/she is going to receive from the list in any >> case, so I usually c

Re: [Tutor] Replying to the tutor-list

2007-02-18 Thread Tim Golden
Dave Kuhlman wrote: > On Fri, Feb 16, 2007 at 11:28:21AM +0000, Tim Golden wrote: >> Kent Johnson wrote: >>> Tim Golden wrote: >>>> field and [EMAIL PROTECTED] in cc: My problem there is that I usually >>>> don't want to send the originating indiv

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
> Here's my problem: I have a directory full of about 2,000 pdf files. I want > to be able to add the > same comment to the "Category" field of each file (in the document properties > of the file). So I am > looking to batch process pdf files (or any filetype, i guess) to add some > metadata.

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Mark Bystry wrote: > getting even closer. figure out how to write to a file but still in vbscript. > > dsofile_write.vbs > code: > Set objFile = CreateObject("DSOFile.OleDocumentProperties") > objFile.Open("D:\test.txt") > objFile.SummaryProperties.Category = "CAT54" > objFile.Save In Python, tha

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Mark Bystry wrote: > Well that's awesome. Thanks for the code. Unfortunately I cannot get it to > run. After I installed > the win32 extensions for python...I get this error when trying to run. > > Traceback (most recent call last): >File "C:\test.py", line 4, in > props.SummaryPropert

Re: [Tutor] Add metadata to a dir of files.

2007-02-22 Thread Tim Golden
Tim Golden wrote: > Slightly bizarrely, it works fine for me on a different > computer (my laptop). Both are Win2K. The only help I > could find on the error code suggested a permission issue, > which isn't likely. That said, I have experienced a few > funnies with the Pytho

Re: [Tutor] Add metadata to a dir of files.

2007-02-23 Thread Tim Golden
Mark Bystry wrote: > Ok, Tim. I believe you're right. If the vbscript is working then I'll > continue to use it and expand > on it. I'll only be using this on my WinXP box anyway. I just didn't want to > offend anyone in this > mailing list with vbscript co

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Tim Golden
Luke Paireepinart wrote: > That's because you can't make tuples of single values. > Parenthesis are ways of controlling order of operation. > They don't create tuples unless there's more than one value. > Think of it like this: > a TUple needs TWO elements or more. > Solution: > use lists. They

Re: [Tutor] howto call DOM with python

2007-03-02 Thread Tim Golden
Alan Gauld wrote: > You can do that in Internet Explorer provided you > a) Have the winall package installed and Just an aid to newcomers: the "winall" package referred to here are the windows-oriented extension modules by Mark Hammond which used to be known as win32all and are now known as pywin

Re: [Tutor] Yet another list comprehension question

2007-03-02 Thread Tim Golden
Andrei wrote: >> "Smith, Jeff" medplus.com> wrote >> >>> In other words, applying somefun to the results of the iterator >>> return >>> duplicates but I want the constructed list to contain none. >>> l = [somefun(i) for i some-iterator if somefun(i) not in l] >>> >>> doesn't work (not that I expe

Re: [Tutor] Printing labels

2007-03-07 Thread Tim Golden
Steve Maguire wrote: > I am a Python beginner. For my first task I wanted to fix a program that I > originally wrote in Excel with VBA. I want to create a mySQL database > holding my DVD collection, edit it in Python, and print labels for the > cases > with an index for filing and a catalog of a

Re: [Tutor] Parsing Word Docs

2007-03-08 Thread Tim Golden
Stephen Nelson-Smith wrote: > Hello all, > > I have a directory containing a load of word documents, say 100 or so. > which is updated every hour. > > I want a cgi script that effectively does a grep on the word docs, and > returns each doc that matches the search term. > > I've had a look at do

Re: [Tutor] Working with files with python (gtk)

2007-03-15 Thread Tim Golden
Edward A Robinson wrote: > I guess what Im looking for is a python command that dose what the > file command in the shell would do > > On 3/14/07, Edward A Robinson <[EMAIL PROTECTED]> wrote: >> This is my first time posting to the python tutor so be nice, I have >> read the mailing list and cant

Re: [Tutor] windows file permissions

2007-03-16 Thread Tim Golden
Kirk Bailey wrote: > I answered my own question digging around and testing stuff. I can't tell you how glad I am to hear that: I was just girding my loins (so to speak) to embark on an explanation of the Win32 ACL model which would have involved seven levels of explanation at the end of which you

[Tutor] cookie expiration date format

2007-03-16 Thread Tim Johnson
following: --- expires Integer expiry date in seconds since epoch, --- I'm not clear what datatype is needed here. Can anyone clarify this for me? Thanks Tim -- Tim Johnson <[EMAIL PROTECTED]>

Re: [Tutor] cookie expiration date format

2007-03-17 Thread Tim Johnson
On Saturday 17 March 2007 02:31, Luke Paireepinart wrote: > Tim Johnson wrote: > > I'm not clear what datatype is needed here. > > Can anyone clarify this for me? > > Sounds like it's an integer or float, such as returned by time.time() > I shouldn't have

Re: [Tutor] cookie expiration date format

2007-03-17 Thread Tim Johnson
On Saturday 17 March 2007 08:13, Tim Johnson wrote: > On Saturday 17 March 2007 02:31, Luke Paireepinart wrote: > > Tim Johnson wrote: > > > I'm not clear what datatype is needed here. > > > Can anyone clarify this for me? > > > > Sounds like it's a

Re: [Tutor] cookie expiration date format

2007-03-19 Thread Tim Johnson
## one second might be good enough! self.expires = expires self.set(name,c) I choose not to override del (using __del__) because it would have necessitated a second argument to del(), as in del(cookie,cookie_name) My class handless multiple cookies. Thanks M

Re: [Tutor] Unicode in List Object

2007-03-26 Thread Tim Golden
Roman Kreuzhuber wrote: > I want to store multiple inputs from text fields in a list-object, which > works as a very small databank. The problem is that this data will contain > unicode characters I'm not sure why you think this is a problem. A Python list can hold anything, including unicode

Re: [Tutor] Unicode in List Object

2007-03-26 Thread Tim Golden
Andre Engels wrote: > 2007/3/26, Roman Kreuzhuber <[EMAIL PROTECTED]>: >> >> Thanks for the quick response! >> I see! Oh I didn't realize that it's not the list which raises an error. >> For a test I tried to insert a string containing a unicode character as >> follows: >> >> ListObject = [] >> Lis

Re: [Tutor] Unicode in List Object

2007-03-26 Thread Tim Golden
Roman Kreuzhuber wrote: > Thanks for the quick response! > I see! Oh I didn't realize that it's not the list which raises an error. > For a test I tried to insert a string containing a unicode character as > follows: > > ListObject = [] > ListObject.insert(0,u"Möälasdji") By the way, aside from

Re: [Tutor] Sloooooow SQL

2007-03-30 Thread Tim Golden
Øyvind wrote: > I have been writing some scripts that gets data from a MSSQL-database. > However, it is very slow. If I use the script, the retrieving of data and > displaying in html takes close to 30 seconds. If I use the SQL Server > Management Query, the same query takes a second or two. Why th

Re: [Tutor] reassign

2007-04-08 Thread Tim Golden
linda.s wrote: > Hi, > I have a list: [2,5,8,0,1,7] > how i can randomly reassign the values to different location in the list? > for example: > Time 1: [5,2,8,0,1,7] > Time 2: [8,0,7,1,5,2] > Have a look at the .shuffle function in the random module. TJG ___

Re: [Tutor] Microsoft Exchange

2007-04-13 Thread Tim Golden
Øyvind Dale Spørck wrote: > Hello. > > I need to get the mailbox size out from Exchange. I have been googling and > all I have found is how to get the size from my personal mailbox. But, > that is not what I need. I need to find the sizes of the mailboxes for all > users. > > Does anyone know of

Re: [Tutor] How to get MAC address using Python at Solaris

2008-03-11 Thread Tim Golden
Henry Zhang wrote: > Hi there, > > I am curious if there is any way in Python to get MAC address at > Solaris? I searched from google, didn't find a good idea. Not tried it, but this looks hopeful at least: http://pypi.python.org/pypi/netifaces/0.4 TJG ___

Re: [Tutor] win32gui, SetForegroundWindow() and setting focus

2008-03-16 Thread Tim Golden
Scott Nelson wrote: > Greetings all... > > I'm looking to use the win32api and win32gui modules to do a bit of > Windows tinkering (win2k) and I've hit a snag. > > I'd like to programmatically set which window has the focus. But > win32gui.SetForegroundWindow(hwnd) seems to be what I'm looking f

[Tutor] loading modules only when needed and PEP 008

2008-03-19 Thread Tim Michelsen
else: pass How would you handle such a case? What is recommended in such a case? Does anyone have experience with this? Thanks for your suggestions in advance! Kind regards, Tim [1] PEP 8 -- Style Guide for Python Code - http://www.python.org/dev/peps/pep-0008/ ___

[Tutor] reading parts of a input string into different variables based on units.

2008-03-19 Thread Tim Michelsen
Hello, I would like to read several parts of a string into different variables based on the (physical) units of the quantities. Here's my testing code: ### mystring = '2m 4cm 3mm' # can also be '1pound 30pence', ... mylist = mystring.split(" ") print mylist first = mylist[0] second =

Re: [Tutor] loading modules only when needed and PEP 008

2008-03-19 Thread Tim Michelsen
> When I do this sort of thing I like > to move my imports into my functions/methods. Would this then be compliant with the style recommendations? > The 'main' code then > conditionally calls the function/method. All the code in the > function safely assumes that the import has been done but co

Re: [Tutor] reading parts of a input string into different variables based on units.

2008-03-19 Thread Tim Michelsen
Hello, thank you for the fast reply! > A regex would avoid that since it would detect an m > as being diffrent to a cm or mm. > > Of course you will have to work out the right regex but that > shouldn't be too difficult if you are sure you have a whitespace > separator and a number followed by th

Re: [Tutor] Scripting Outlook

2008-03-27 Thread Tim Golden
Justin Cardinal wrote: > Can anyone direct me to some examples/documentation for using python to work > with Outlook? So far, the most useful thing I've come across is a post from > someone with problems adding an attachment: > http://mail.python.org/pipermail/python-list/2002-August/160894.html >

Re: [Tutor] Scripting Outlook

2008-03-27 Thread Tim Golden
Justin Cardinal wrote: > Can anyone direct me to some examples/documentation for using python to work > with Outlook? So far, the most useful thing I've come across is a post from > someone with problems adding an attachment: and just for another example, here's some older code which I post untest

Re: [Tutor] Don't miss "Python-by-example - new online guide to Python Standard Library"

2008-04-04 Thread Tim Golden
linuxian iandsd wrote: > well, good to see something like this comming ... i used to browse for hours > to find nothing but long long documentation & not a single real life > example... but i guess its because i m used to the old 'howto' way of > ducumentation ... It's one of those things; peopl

Re: [Tutor] SQLite LIKE question

2008-04-11 Thread Tim Golden
Dinesh B Vadhia wrote: > Okay, I've got this now: > >> con = sqlite3.connect(":memory:") >> cur = con.cursor() >> cur.execute("""CREATE TABLE db.table(col.a integer, col.b text)""") >> con.executemany("""INSERT INTO db.table(col.a, col.b) VALUES (?, ?)""", m) >> con.commit() > >> for row in con.e

Re: [Tutor] Old School

2008-04-11 Thread Tim Golden
Dinesh B Vadhia wrote: > I belong to the Old School where getting my head around OO is just one big > pain. > I write software by modularization executed as a set of functions - > and it works The great thing about Python is that you can use Classes if you want, or not if you don't. I use them

[Tutor] setting program configuration for all files and modules of a program

2008-04-14 Thread Tim Michelsen
Hello, I am building a simple GUI for a calculation program. I am using config files (*.cfg) and reading them in with ConfigParser. This works well because I have nearly all code in 1 text file. But I would like to modularize my code and separate the GUI code from the functional code that provid

<    1   2   3   4   5   6   >