Re: How to improve this code?

2009-09-15 Thread Tim Golden
Sol Toure wrote: def are_elements_present(sourceList, searchList):for e in searchList: if e not in sourceList: return False return True Using set: def are_elements_present(sourceList, searchList): return len(set(sourceList).intersection(set(searchList

Re: How to improve this code?

2009-09-15 Thread Tim Golden
Tim Golden wrote: Unless I'm missing something, (and I didn't bother to read the original code so I may be) that's a subset test: set (searchList) <= set (searchList) (cough) or, rather: set (searchList) <= set (sourceList) TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy directory tree without copying files

2009-09-23 Thread Tim Golden
Jeremy Conlin wrote: I am trying to copy a folder hierarchy from one location to another. I can use the shutil.copytree function to copy the folder tree, but I don't want the files copied, just the folders. What is a good way to approach this? Thanks, Jeremy Use os.walk and create the directo

Re: Copy directory tree without copying files

2009-09-23 Thread Tim Golden
Jeremy Conlin wrote: On Sep 23, 9:15 am, Tim Golden wrote: Jeremy Conlin wrote: I am trying to copy a folder hierarchy from one location to another. I can use the shutil.copytree function to copy the folder tree, but I don't want the files copied, just the folders. What is a good w

Re: Finding application data after install - a solution?

2009-09-24 Thread Tim Golden
Wolodja Wentland wrote: I think many Windows users would say WTF!? when seeing those directories - and send cordial greetings to you, your parents and your whole family :) That is probably true, but Windows has a 'etc' directory (c:\windows\system32\drivers\etc) which AFAIK contains the hosts f

Re: Finding application data after install - a solution?

2009-09-24 Thread Tim Golden
Wolodja Wentland wrote: On Thu, Sep 24, 2009 at 12:51 +0100, Tim Golden wrote: Wolodja Wentland wrote: Is CSIDL_COMMON_APPDATA and environment variable set on all Windows flavours? Just to clarify, now that I read your post more carefully, there *is* an environment variable APPDATA which is

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread Tim Golden
On 30/08/2010 3:24 PM, pyt...@bdurham.com wrote: My understanding is that the only time one needs to use shell=True is when they are 'executing' a non-executable file whose executable must be discovered via file association rules? Does that sound accurate? I'm not entirely sure what you mean by

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 16:15, Greg Miller wrote: I'm trying to get the following code converted to Python...and am stuck if(GetMessage(&msg.NULL,NULL,NULL)) { if(msg.message == WM_TIMER) { TranslateMEssage(&msg); DispatchMessage(&msg); } } I think GetMessage i

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 5:41 PM, Greg Miller wrote: Thank you for the assist! Quick question though, using the first example is there any need to register for WM_TIMER, ( instead of registering for WM_HOTKEY ), or is extracting the "home grown Windows message loop" enough and just run with that? In shor

Re: About __class__ of an int literal

2010-09-28 Thread Tim Golden
On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker but

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 10/10/2010 22:51, John Henry wrote: I have a need to read .msg files exported from Outlook. Google search came out with a few very old posts about the topic but nothing really useful. The email module in Python is no help - everything comes back blank and it can't even see if there are attac

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 11/10/2010 4:39 PM, John Henry wrote: I am trying your code but when it get to the line: mapi.MAPIInitialize ((mapi.MAPI_INIT_VERSION, 0)) I got the error message: Either there is no default mail client or the current mail client cannot fulfill the messsage requrest. Please run Micr

Re: Reading Outlook .msg file using Python

2010-10-12 Thread Tim Golden
On 12/10/2010 4:59 PM, John Henry wrote: According to: http://support.microsoft.com/kb/813745 I need to reset my Outlook registry keys. Unfortunately, I don't have my Office Install CD with me. This would have to wait. Thanks for the information; I'm keen to see if you're able to use the so

Re: subprocess.check_call() fails ... but only on my production machine

2010-10-13 Thread Tim Golden
On 12/10/2010 14:31, Chris Curvey wrote: I've got a python program running on windows that executes a command- line script. The command being executed is: print cmd "C:\Program Files\ImageMagick-6.6.1-Q16\convert.exe" -density 72x72 "c: \temp\choicepoint 2010-01 Stmt_p1.pdf" -quiet -region (6

Re: Help needed - To get path of a directory

2010-10-14 Thread Tim Golden
On 13/10/10 15:26, Bishwarup Banerjee wrote: I want to get the absolute path of the Directory I pass explicitly. Like functionName("\abcd"). On 13/10/2010 05:44, Kingsley Turner wrote: One way to achieve this is to fetch a recursive directory list for all drives, and then search for your direc

Re: Whining about "struct"

2010-10-14 Thread Tim Golden
On 14/10/2010 05:30, Tim Roberts wrote: I have a bad memory. I admit it. Because of that, the Python "help" system is invaluable to me. Up through Python 2.5, I could get a quick reference to the format specifiers for the struct module via import struct; help(struct) I used that a LOT. Bu

Re: Reading Outlook .msg file using Python

2010-10-17 Thread Tim Golden
On 17/10/2010 6:39 AM, John Henry wrote: On Oct 12, 10:31 am, Tim Golden wrote: On 12/10/2010 4:59 PM, John Henry wrote: According to: http://support.microsoft.com/kb/813745 I need to reset my Outlook registry keys. Unfortunately, I don't have my Office Install CD with me. This

Re: Reading Outlook .msg file using Python

2010-10-18 Thread Tim Golden
On 17/10/2010 20:25, John Henry wrote: Not knowing anything about MAPI, I tried a number of the MAPI flags, the only one that works appears to be PR_SUBJECT. PR_CLIENT_SUBMIT_TIME, PR_CREATION_TIME and so forth doesn't work. I'll try to fish out some of the code we use, but for most of the fiel

Re: Windows: getting notification about power state changes

2010-10-19 Thread Tim Golden
On 19/10/2010 10:06, Gelonida wrote: I'd like to be notified about certain events and call certain python functions depending on the event. call a function: - before (or after) the screen saver kicks in - before (or after) the monitor is switched off - before (or after) the hard disk is switched

Re: Reading Outlook .msg file using Python

2010-10-20 Thread Tim Golden
On 19/10/2010 22:48, John Henry wrote: Looks like this flag is valid only if you are getting messages directly from Outlook. When reading the msg file, the flag is invalid. Same issue when accessing attachments. In addition, the MAPITable method does not seem to work at all when trying to get

Re: Unix-head needs to Windows-ize his Python script

2010-10-21 Thread Tim Golden
On 20/10/2010 18:38, gb345 wrote: I have a handy Python script, which takes a few command-line arguments, and accepts a few options. I developed it on Unix, with very much of a Unix-mindset. Some Windows-using colleagues have asked me to make the script "easy to use under Windows 7". I.e.: no

Re: Reading Outlook .msg file using Python

2010-10-21 Thread Tim Golden
On 21/10/2010 09:34, Jon Clements wrote: Only just noticed this thread, and had something similar. I took the following approach:- (I'm thinking this might be relevant as you mentioned checking whether your client's Outlook could export .EML directly, which indicates (to me at least) that you ha

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-22 Thread Tim Golden
On 22/10/2010 15:25, gb345 wrote: 3. Both versions of the app work fine on Windows 7, as long as I do the following: a. run CMD b. cd to where the GUI script and my original script live c. execute either C:\Python27\python myapp_tk.py or C:\Python27\python myapp_wx.p

Re: Python documentation too difficult for beginners

2010-11-02 Thread Tim Golden
On 02/11/2010 11:23, jk wrote: This (http://epydoc.sourceforge.net/stdlib/) is what I'm talking about. Why aren't the official docs like this, and why has it taken me 2 days of searching? All this needs is a search engine behind it and it'd be perfect. I'm glad you find the epydoc format usefu

Re: problem with opening a new python program in a new window (and keeping track of the process)

2010-11-03 Thread Tim Golden
On 02/11/2010 20:55, Zak Kinion wrote: What I want to do: launch seperate python programs from one main program (multi-threading will not achieve this because the mechanize library uses one shared global opener object which will not suit my needs) I want the scripts launched to be in seperate w

Re: A matter of queues, tasks and multiprocessing

2010-11-11 Thread Tim Golden
On 11/11/2010 14:04, Emanuele D'Arrigo wrote: On Nov 10, 9:19 pm, "danmcle...@yahoo.com" wrote: If you are using Python 2.6 or greater, look into the multiprocessing module. It may contain 90% of what you need. Thank you Dan, indeed the multi-processing module has been my first port of call an

Re: another newbie question

2010-11-14 Thread Tim Golden
On 14/11/2010 3:00 PM, Nitin Pawar wrote: I'm trying to get floating point division to work; I'm using Python 2.6.5. When I enter 'from _future_ import division' at the command line, I get the ImportError, no module named _future_. How can I rectify this? That should be two underscores, not one

Re: Repeating of posts

2017-02-10 Thread Tim Golden
On 10/02/2017 16:20, Rob Gaddi wrote: On 02/10/2017 07:25 AM, Grant Edwards wrote: On 2017-02-10, Cecil Westerhof wrote: I see a lot of post delivered multiple times. Is that a problem at my side, or are others experiencing this also? I see it too. Same as a a month or two back, but not as

Re: Who still supports recent Python on shared hosting

2017-03-06 Thread Tim Golden
On 06/03/2017 02:39, John Nagle wrote: I'm looking for shared hosting that supports at least Python 3.4. Hostgator: Highest version is Python 3.2. Dreamhost: Highest version is Python 2.7. Bluehost: Install Python yourself. InMotion: Their documentation says 2.6. Is Python on shared hosting dea

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-09 Thread Tim Golden
On 08/03/2017 22:10, Chris Angelico wrote: On Thu, Mar 9, 2017 at 8:25 AM, Chris Green wrote: Chris Angelico wrote: On Thu, Mar 9, 2017 at 6:27 AM, Chris Green wrote: dbcol['firstname'] = col('First Name', True, False) dbcol['lastname'] = col('Last Name', True, False) http://www.k

Re: Python and the need for speed

2017-04-11 Thread Tim Golden
On 11/04/2017 00:33, Chris Angelico wrote: If he does, it might be the final thing that gets him banned from the mailing list. A meta-note, since I happen to have seen this email come up. I don't know about the other list moderators, but I don't personally follow every sprawling thread and po

Moderating the list [was: Python and the need for speed]

2017-04-11 Thread Tim Golden
eve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. What exactly do Tim Golden and Ethan Furman moderate on? We (and the other moderators) exactly moderate the mailing list. I have no authority over the newsgroup, and I don't kno

Re: Moderating the list [was: Python and the need for speed]

2017-04-13 Thread Tim Golden
On 13/04/2017 03:39, Jason Friedman wrote: However, it's simply a technical fact: the thing which we moderate is the mailing list. We can control which posts make it through from the newsgroup by blocking them at the gateway. But the posts will continue to appear on comp.lang.python which is, a

Re: Bigotry (you win, I give up)

2017-04-26 Thread Tim Golden
On 26/04/2017 08:00, m.n.summerfield--- via Python-list wrote: Surely it is time to stop the "Robert L." emails? We're currently blocking the "Robert L." emails through the list gateway. And -- barring one, which was passed through by mistake -- I've not seen any hit the list itself lately. T

Re: Rosetta: Sequence of non-squares

2017-05-02 Thread Tim Golden
On 02/05/2017 11:18, Rhodri James wrote: On 02/05/17 08:20, Mark Summerfield via Python-list wrote: (The posts are already filtered out of the official comp.lang.python list, but they can't do this for the Google Groups version.) Careful! The posts are filtered out of the official Python mail

Re: Spammy spam spam spam spam

2017-07-04 Thread Tim Golden
On 04/07/2017 16:40, Steve D'Aprano wrote: On Tue, 4 Jul 2017 10:55 pm, Case Solution & Analysis wrote: Our e-mail address is CASESOLUTIONSCENTRE (AT) GMAIL (DOT) COM. Please replace (at) by @ and (dot) by . Since we don't yet have a protocol for transmitting a punch to the face over TCP/IP,

Re: School Management System in Python

2017-07-05 Thread Tim Golden
On 05/07/2017 13:49, Thomas Nyberg wrote: On 07/05/2017 02:14 PM, Sam Chats wrote: Thanks for your suggestions. I would've not used pickle had I been aware about other tools while developing this. I was thinking about migrating to sqlite3. How about that? And yes, I need more comprehanesive do

Meta: double posts [Was: School Management System in Python]

2017-07-05 Thread Tim Golden
Are you posting both to python-list@python.org and to comp.lang.python -- and under different names? If you are, please use one or the other: they mirror both ways, and we're seeing double posts which the gateway thinks are different because of a different sending address. Thanks TJG -- htt

Re: how to get partition information of a hard disk with python

2017-07-07 Thread Tim Golden
On 07/07/2017 07:18, palashkhair...@gmail.com wrote: On Wednesday, September 22, 2010 at 4:01:04 AM UTC+5:30, Hellmut Weber wrote: Hi list, I'm looking for a possibility to access the partiton inforamtion of a hard disk of my computer from within a python program. Googling I found the module 'p

Re: Recent Spam problem

2017-07-26 Thread Tim Golden
On 25/07/2017 06:13, Rustom Mody wrote: Of late there has been an explosion of spam Thought it was only a google-groups (USENET?) issue and would be barred from the mailing list. But then find its there in the mailing list archives as well Typical example: https://mail.python.org/pipermail/pyt

Re: Express thanks

2017-08-25 Thread Tim Golden
On 21/08/2017 15:34, Hamish MacDonald wrote: I wanted to give a shout out to the wonderfully passionate contributions to python I've witnessed following this and other mailing lists over the last little bit. The level of knowledge and willingness to help I've seen are truly inspiring. Super mo

Re: Reading the documentation

2017-08-26 Thread Tim Golden
On 26/08/2017 03:22, Rick Johnson wrote: Steve D'Aprano wrote: Rustom Mody wrote: Ian wrote: "Larry Martell" wrote: 9:21 PM Rustom Mody wrote: Statement 1: Aeroplanes fly. Statement 2: Submarines swim. Are these two statements equally acceptable? [Inspired by a talk by Noam Chomsky] There

<    11   12   13   14   15   16