Re: [Tutor] Python Examples of processing MS Outlook
-Original Message- From: tutor-bounces+mike.hansen=atmel@python.org [mailto:tutor-bounces+mike.hansen=atmel@python.org] On Behalf Of Peter Meagher Sent: Friday, April 16, 2010 3:13 AM To: tutor@python.org Subject: [Tutor] Python Examples of processing MS Outlook Greetings, I'm doing a lot of email processing at the moment. I put together some basic code from within Outlook to open my default inbox, filter email records based on text in the Subject field, then parse the body, finally send the output to a text file. This is simple stuff but very useful. I need to do more, however as a newbie with Python, I figured I could both learn and produce at the same time. Does anyone have references to simple MS Outlook 2007 processing code that I could vulture for my purposes? (The code that I adapted was from an old Office 2000 vba text, so the version 2007 may not be that essential to my purposes) After much searching, I found a reference to PyWebmail, however it communicates directly to the webmail accounts, is much more than I really need and I want to stay in the Outlook environment for a number of reasons, particularly its interface to Access. Thank you. Peter Meagher You probably need to look at Python COM. Another problem with Outlook is that it has some security that prevents other programs from controlling it in response to various virus attacks. I think there's a way around it. Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Recommendations on Workshops, Courses, Live Online Training
-Original Message- From: tutor-bounces+mike.hansen=atmel@python.org [mailto:tutor-bounces+mike.hansen=atmel@python.org] On Behalf Of Tino Dai Sent: Thursday, March 11, 2010 12:29 PM To: Alan Gauld Cc: tutor@python.org Subject: Re: [Tutor] Recommendations on Workshops, Courses,Live Online Training On Thu, Mar 11, 2010 at 1:22 PM, Alan Gauld alan.ga...@btinternet.com wrote: Khalid Al-Ghamdi emailkg...@gmail.com wrote I've subscribed to ShowMeDo, but I feel something more than just video tutorials. Do you have any recommendations on where I can find workshops, Courses, Live Online Training where I can interact with a real person that I can ask questions and find the answers I'm looking for. Well (most) folks on the tutor list are live, and real opersons and we answer questions... But if you mean face to face then consider a Python users group - or evenas Linux User Group(more of them) since Linux users are often python users too... Alan and the rest of the tutor regulars, I do know of a place in North Carolina, and the president of the company spoke @ PyCon this year. I don't know if this is the correct venue to put that sort of information. Guidance please. :) -Tino If you have a pile of $ that you don't know what to do with, or if your company has deep pockets, then Big Nerd Ranch sounds like fun. http://www.bignerdranch.com/classes/python Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] What Editori?
I'm surprised no one has mentioned ActiveState's KOMODO. I primarily use VIM, but I hop into KOMODO for doing little scripts and watching the output. KOMODO comes in two flavors, KOMODO Edit which is free and KOMODO IDE which costs about $300. I suspect that KOMODO Edit does most of what people need. For those that don't want the steep learning curve of VIM or Emacs, I'd recommend KOMODO. Mike No, I don't work for ActiveState. =) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order ofmodulesandother matters (XP vs W7, ...)
-Original Message- [mailto:tutor-bounces+mike.hansen=atmel@python.org] On Behalf Of Alan Gauld Sent: Tuesday, February 16, 2010 5:58 PM Hansen, Mike mike.han...@atmel.com wrote I'm aware of Pep8. It's a good starting point. Anything more in-depth than Pep8 and the Zen of Python? There is the generic book Code Complete which is excellent, but definitely not short! And it's not Python specific - in fact doesn't even mention Python so far as I recall. But its advice is applicable to all languages. A bug fan, Alan g. Are you a bug fan of Code Complete? =) I need to revisit Code Complete. I read a huge amount of the first edition and about a 1/3 of the second edition. Although you can gather best practices from Pep8, the Zen of Python, The Python Cookbook, and other sources, it appears that a central resource for Python best practices doesn't exist. Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order of modules andother matters (XP vs W7, ...)
-Original Message- From: tutor-bounces+mike.hansen=atmel@python.org [mailto:tutor-bounces+mike.hansen=atmel@python.org] On Behalf Of Kent Johnson Sent: Saturday, February 13, 2010 8:06 AM To: Wayne Watson Cc: Tutor Python Subject: Re: [Tutor] The Order of Imports and install order of modules andother matters (XP vs W7, ...) On Fri, Feb 12, 2010 at 10:55 PM, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: There seems to be something of a general consensus in ordering import statements. Something like standard library imports first. When using tools like matlablib or tkinter (maybe), must one keep an order among the relevant imports? I don't know if there is a general consensus but what I like to do is standard library imports third-party library imports application-specific imports Within each group I tend to group import x imports before from x import y imports and alphabetize by module name. I'm not strict about that though. This make me wonder. Is there a document or web site that has Python Best Practices? Something along the lines of the Perl Best Practices book, but probably shorter. =) Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] The Order of Imports and install order of modules andother matters (XP vs W7, ...)
From: sri...@gmail.com [mailto:sri...@gmail.com] On Behalf Of Wayne Werner Sent: Tuesday, February 16, 2010 1:07 PM To: Hansen, Mike Cc: Tutor Python Subject: Re: [Tutor] The Order of Imports and install order of modules andother matters (XP vs W7, ...) http://www.python.org/dev/peps/pep-0008/ This make me wonder. Is there a document or web site that has Python Best Practices? Something along the lines of the Perl Best Practices book, but probably shorter. =) HTH, Wayne I'm aware of Pep8. It's a good starting point. Anything more in-depth than Pep8 and the Zen of Python? Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor list as pair progamming plush toy
-Original Message- From: tutor-bounces+mike.hansen=atmel@python.org [mailto:tutor-bounces+mike.hansen=atmel@python.org] On Behalf Of Mac Ryan Sent: Friday, February 12, 2010 8:33 AM To: tutor@python.org Subject: [Tutor] Tutor list as pair progamming plush toy Have you ever got that piece of advice about - when you have stuck on a bug you seem unable to track - getting a plush toy to whom you explain your code? (This is of course a workaround if you do not have a fellow developer to help you out). Well... I found out this advice kind of works for me, with the notable difference that my plush toy is this mailing list. It works so wonderfully that indeed is several months I do not post any message: whenever I get stuck, I begin to write a message to the list, and in the process of explaining what is the intended behaviour and outcome of my code, I systematically find the bug by myself. I know - this is slightly OT for the list - but I thought to share as maybe this is a hidden benefit the list is bringing to a few people without the tutors even knowing it. Does anybody else experience the same? Cheers, :) Mac. This kind of sounds like the rubber duck method of debugging. http://lists.ethernal.org/oldarchives/cantlug-0211/msg00174.html Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Variable declaration
Perl has use strict; to force variable declaration. My insane Perl loving co-workers think it's evil that Python doesn't have variable declaration. =) What are some of the reasons/arguments on why Python doesn't need variable declaration? I've gotten around it in Python by using Pyflakes to check my code and catch those silly mis-spelling of a variable. Mike ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Providing Solutions for all the Common Questions
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Calvin Spealman Sent: Tuesday, October 21, 2008 8:07 AM To: tutor@python.org Subject: [Tutor] Providing Solutions for all the Common Questions There was a discussion in the #python channel over at freenode about the common questions we seem to field daily. These often revolve around problems a lot of people need solutions for, and for which we have specific answers to we always give. A lot of times this leads to teeth grinding as we try to convince people about our advice. Why else are they asking if they then argue with the answers they get? This takes a lot of time and energy, so a number of us are starting a project to produce tutorials, guides, and explanations to back up a lot of these solutions. For example, a lot of people look to write an irc bot when they learn Python, and often they either plan or are suggested to use Twisted. A tutorial specifically for this need is being written. We've decided to come here to organize this, as it seems to fit. So there are some organizational issues to approach. I thought AppEngine would be a good place to host everything, so I've already registered pythonguides.appspot.com and plan to throw up a basic Wiki to start. Going forward there are some things I want to implement there to support our specific needs. For now, its just a free host. One other initial need is to collect the problems we need to provide our solutions for. So, what do we people ask over and over? -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy A long time ago in a Python galaxy far far away, a tutor FAQ was written. It has been bounced around. I found it at http://effbot.org/pyfaq/tutor-index.htm. Some of these entries could use some updating. A basic wiki for these FAQs would be great. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Output parameters from a stored procedure
Does anyone know how to get the output parameters from a stored procedure? I'm using pymssql on a linux box to call a stored procedure on a mssql database. I'm not sure of the correct syntax to get the output parameters. import pymssql con = pymssql.connect(host='x',user='',password='x',database='x') cur = con.cursor() query = EXECUTE blah blah blah cur.execute(query) con.commit() con.close() Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] cx_oracle module problems
Subject: [Tutor] cx_oracle module problems I've downloaded the cx_oracle source module for python, howerver every time i try to build it, it keeps on failing. I've been unable to find a port for Ubuntu. Is there one? Anyone know how to get this properly installed? # sudo python setup.py install Traceback (most recent call last): File setup.py, line 36, in module oracleHome = os.environ[ORACLE_HOME] File /usr/lib/python2.5/UserDict.py, line 22, in __getitem__ raise KeyError(key) KeyError: 'ORACLE_HOME' Link: http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-4.2.tar .gz?download Thanks, JJ Did you python setup.py build first? The README.txt mentions it along the option of doing a binary install. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] cx_oracle module problems
Got it. Thanks. When i try 'python setup.py build' i get the following error. $ sudo python setup.py build Traceback (most recent call last): File setup.py, line 72, in module raise DistutilsSetupError, cannot locate an Oracle software installation distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation Thoughts? This means you don't have Oracle installed, or setup.py can't find it. -Wayne I'm guessing that you'll need to install the .deb file from this site. Someone can correct me if I'm wrong. http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html There's installation instructions for Debian(Which I believe Ubuntu is derived from) here: http://www.oracle.com/technology/software/products/database/xe/files/install.102/b25144/toc.htm#BABFEDEI After the client is installed, then hopefully you can build and install the cx_oracle module. Good luck. If you get stuck maybe someone else can pipe in. Unless it's something simple, I usually have trouble if a package is unable to install due to some missing library or what not. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Sorting Dictionary of Dictionary by certain Value
-Original Message- Hi Pythonistas, I have a large dictionary of dictionary (50,000+ keys) which has a structure as follows: DoD = { 'flintstones' : { 'husband' : fred, 'pal' : barney, 'income': 500, }, 'jetsons' : { 'husband' : george, 'wife' : jane, 'his boy' : elroy, 'income': 700, }, 'simpsons' : { 'husband' : homer, 'wife' : marge, 'kid' : bart, 'income': 600, }, }; I want to sort the dictionary by 'income' Is there an efficient way to do the same. Thanks in advance. - Jo This sounds like it'd be a good job for a database...perhaps SQLite? Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Web programming advice
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dorje tarap Sent: Friday, September 19, 2008 9:38 AM To: Tutor@python.org Subject: [Tutor] Web programming advice Hi All, I would really like to learn about using python for creating a website from scratch to allow me to learn about web programming and python. I have zero experience of web programming, and some limited exposure to python. Can someone recommend a book or resource that will introduce me to web programming. Thanks I suggest you learn to crawl before you learn to walk and run. Do a simple form processing exercise using the cgi module to get a better understanding of how web programming works. Experiment with a templating language. Then you can try some of the web frameworks like Turbogears, Django, Web.py, ... Of course, ask questions here if you need help. http://www.devshed.com/c/a/Python/Writing-CGI-Programs-in-Python/ http://docs.python.org/lib/module-cgi.html http://wiki.python.org/moin/WebProgramming Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] NetBeans IDE
Being an editor/IDE junkie, I'm curious about the NetBeans IDE. Is anyone using it? If so, how is it? I believe it has a add-on for python.(NBPython) Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Support for datetime module
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Saturday, September 06, 2008 7:08 AM To: [EMAIL PROTECTED] Cc: tutor@python.org Subject: Re: [Tutor] Support for datetime module On Sat, Sep 6, 2008 at 2:42 AM, Johan Geldenhuys [EMAIL PROTECTED] wrote: Hi all, I have want to use the datetime module on a system with ver 2.2.3 installed. I know it's very old, but that's what I have to deal with and can't upgrade. So please don't suggest that. As you know datetime was available from version 2.3. I want to know where can I get the datetime module so that I can include it in my package that I use on my device? datetime is implemented in C so getting the version from 2.3 to work on 2.2 might be difficult. Apparently the version in the std lib is derived from a Python version that was part of Zope, this might be helpful if you can find the source it refers to: http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage Kent This is probably moot since the OP solved the issue using other means, but I thought datetime was based on mxdatetime. Even if it isn't, mxdatetime supports Python 2.1 and newer. http://www.egenix.com/products/python/mxBase/mxDateTime/ Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Docs (Was: Reformatting phone number)
On Thu, Aug 21, 2008 at 12:01 PM, Dotan Cohen [EMAIL PROTECTED] wrote: 2008/8/21 Kent Johnson [EMAIL PROTECTED]: Chapters 2 and 3 of the library reference are highly recommended. http://docs.python.org/lib/lib.html Let's start from there. I need the startswith() function, but I do not know it's name. I search for strings and find this: 4. String Services * 4.1 string -- Common string operations o 4.1.3 String functions You went too far. Look at 3.6 (Sequence types) and 3.6.1 (String Methods). Those document operations that work on all types of sequences and the methods of the string type. That's 99% of what you'll need to know about python strings. Kent was pretty specific about looking at chapter two and three of the library reference. Why did you start with chapter four instead? But on that page, this is all there is: The following functions are available to operate on string and Unicode objects. They are not available as string methods. ... So Python has only two string functions? That's what it looks like. There are only two (non-deprecated) functions in the string module. Thanks, Kent. I will be a nuisance! Is there any place to suggest improvements to the docs? I see on the python.org site it is suggested to email website bugs to the site admin. Does that go for the docs? I am not the one to improve them at this time, as I am unfamiliar with the language, but I could report usability issues such as that mentioned here. I believe that doc bugs (and suggestions for improvements) are tracked on the python bug tracker (http://bugs.python.org/). If you're going to submit doc patches, you may want to take a look at http://docs.python.org/dev/3.0/ which I believe is the beta of the new documentation layout for python 3.0. I'm not sure how much the actual contents have changed from the 2.x docs though. I notice that the section on the string module does now refer you back to the methods of string and sequences in general, which the current docs do not. -- Jerry ___ I can't put my finger on it, but there's something lacking in the docs. They are not terrible, but they aren't fantastic either. I'm not entirely sure what I'd do to fix them. I usually rely on Learning Python, The Python Standard Library, the Global Module Index section of the docs, and sometimes Python in a Nutshell. I need to get in the habit of using help in the shell. Sometimes the docs for a particular module might be a little obtuse for me especially if it doesn't have example code. That's where The Python Standard Library book comes in handy since it has example code. After experimenting in the shell, if I really get stuck, I'll ask on this list. Maybe having tags or something to help with searches. On the string methods page, have a tag called string functions. I don't think many new to the language are going to know that they are called string methods and not string functions. I guess it depends on what language they are coming from if any at all. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] study advice on javascript to python hand-off
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Johnson Sent: Thursday, August 14, 2008 9:08 AM To: Serdar Tumgoren Cc: tutor@python.org Subject: Re: [Tutor] study advice on javascript to python hand-off This is a three tier framework where you can use any back end you want. They currently support the major ones: MySQL, SQLite, PostGreSQL, MSSql to name the ones I can think of. http://dabodev.com/wiki/FrontPage -- Jeff Jeff Johnson [EMAIL PROTECTED] Phoenix Python User Group - [EMAIL PROTECTED] Dabo might be a good solution if you are making GUI client-side apps. Note that the OP mentioned using Javascript, so I'm assuming that the OP is thinking about a web-based front end. It really depends on the number of users and other factors. If there are many users, then a web-based front end is possibly better in that each user does not have to install software to use the application.(Only the browser is required) Having each user install software can become a maintenance nightmare if not implemented properly. Having the entire application on a server allows you to make changes without having to deploy it to many users. On client-side GUI apps, it'd be good to develop something that checks if a new version of the software is necessary to download. Oh well, I think I've babbled on enough about client side apps vs web-based server side apps. I guess you get the idea. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] study advice on javascript to python hand-off
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Serdar Tumgoren Sent: Thursday, August 14, 2008 9:35 AM To: tutor@python.org Subject: Re: [Tutor] study advice on javascript to python hand-off Thanks all for the quick responses. Yes, though Dabo looks like an interesting tool, I am headed the route of a web-based form. @Chad: I haven't checked out Turbogears but have been dabbling with django for a bit. Djanog's baked-in admin interface for data entry approaches what I'm trying to accomplish, but doesn't quite get me there. But I figured I needed to get back to basics. So just to clarify, is this indeed something that is properly accomplished using Ajax? (whether xml or json)? Meantime, I'll get started reading up on HTTP. It's one area I haven't really delved into yet. Thanks again! You might look at using a JavaScript toolkit like Dojo to handle your AJAX and JavaScript events. The nice thing about these is they make it easy to do AJAX calls and work across multiple browsers. JQuery seems to be the popular one now, but there are many JavaScript toolkits to choose from. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] What has Editor X got that PyWin32 hasn't?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jaggo Sent: Tuesday, August 12, 2008 12:32 PM To: tutor@python.org Subject: [Tutor] What has Editor X got that PyWin32 hasn't? Hello. I haven't much experience with programming. I'd like to point this question to programmers who write in editors other than the default PyWin32: Why do you use your editor rather than using Pywin? What feature has editor X got that PyWin hasn't? (That is, other than My editor runs on unix / linux; while that does count for something it is rather irrelevant to my current situation.) Thanks in advance, Omer. Is that the editor that comes with Activestate's Python distribution for Windows? If so, I haven't used in a very long time. I switch between VIM and Komodo IDE. I don't remember the pythonwin editor having code completion for python, syntax highlighting for other languages(Perl? Ruby? HTML?), ftp, integration with your favorite source code control system, a spell checker, the ability to script it or record macros, an MP3 player, voice recognition, a Vulcan mind-meld programming link, oh... those last three are probably in emacs.. %-) Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Any Italian speakers?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld Sent: Sunday, August 03, 2008 4:55 PM To: tutor@python.org Subject: [Tutor] Any Italian speakers? I received this message which Google tells me is Italian but then only gives a partial translation... Can anyone help? --- voglio chiderti solo 1 cosa ... ma secondo te qualle e il miglior programma X programmare??? grazie ... da Cristian - Alan G. Alan, Unfortunately, I only speak and read/write English. Did you find anyone to traslate? I plugged it into Bablefish and tried Italian to English and here's what I got.(Probably the same as you.). I want chiderti only 1 thing... but according to you qualle and better program X to program? thanks I also tried Spanish, Potuguese, and Greek, but the Italian one came out the best. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Exploring the Standard Library
[mailto:[EMAIL PROTECTED] On Behalf Of Nathan Farrar Sent: Saturday, July 05, 2008 12:24 PM To: Python Tutor Subject: [Tutor] Exploring the Standard Library I'd like to spend some time exploring the standard library. I'm running python on Ubuntu. How would I find the location of the modules (find / -name os.py does not yield results)? Thanks! Nathan I'm a bit behind on reading the tutor list. I don't think I saw anyone mention The eff-bot guide to the standard library. Granted, it might be a little dated, but I suspect that most of the modules haven't changed that much since it was written. I like it because it has example code. http://effbot.org/zone/librarybook-index.htm Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to pythong
Subject: Re: [Tutor] New to pythong Hello everybody: I am new to this mailing list, and it said that i could the simplest of questions. So i was wondering if anyone could be so kind as to e-mail me a project idea or something to go out an learn to do in python. I don't know any languages, but i am definitely not computer illiterate. i have read so many tutorial about getting started but so far that is where the tutorial have left me ( how to print Hello World) and such. Any ideas great thanks. There's some ideas on the tutor FAQ: http://effbot.org/pyfaq/tutor-im-learning-python-what-should-i-program.h tm Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Possible to import imports?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rob Kirkpatrick It was mostly an exercise in understanding import orders/precedence but I thought I might be able to use it to simplify imports for modules within a package that might all use the same or similar standard imports. The one I see a lot of is modules in the package routinely importing os and sys so I thought that if I could just import them once at the highest package level then just have the modules import their parent package, things would be cleaner. You make a good point about that causing more confusion than it's worth though, so I'll shelve that idea for the time being. Funny though that I did try using something like foo.datetime but I must have buggered up something cause I couldn't get it to work... Thanks Kent! Someone on the list can correct me if I'm wrong, but I think performing imports on the same module doesn't have any negative impact. I try to keep each of my modules importing what they need. If my main program also needs that module, I'll import it in the main program. I think it helps for readability. Also each module can stand on it's own and not use another modules import of other modules. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDE
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael yaV Sent: Tuesday, June 10, 2008 8:45 AM To: Alan Gauld Cc: tutor@python.org Subject: Re: [Tutor] IDE How about for the Mac platform? Textmate(not open source) but most who program on the mac love it. TextWrangler(not open source, but free) Open source --- VIM Emacs(Aquamacs) Eclipse Probably not considered IDEs Smultron SubEthaEdit Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDE
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean Novak Sent: Tuesday, June 10, 2008 5:08 AM To: tutor@python.org Subject: [Tutor] IDE I'm looking for the perfect IDE, preferably open source. I've installed Bluefish, which I find to be a little buggy still. I'm just starting to dive into emacs, which I feel is a little daunting. If someone has tried a few different IDEs and found the one that they love.. I'd be interested in your insight! Thank you! Sean Since you mentioned Bluefish, I'm assuming you are on a Linux/Unix system. VIM Emacs SPE(I'm not sure if it's open source, but it's free) Komodo Edit Eclipse w/Pydev Eric4 I use VIM the majority of the time. The company I work for purchased Komodo IDE for me, and I use it off and on. I do my development on a Windows XP machine mostly for web applications that run on a Linux box. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDE
-Original Message- From: Michael yaV [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2008 12:13 PM To: Kent Johnson Cc: Hansen, Mike; tutor@python.org Subject: Re: [Tutor] IDE Since I'm on a mac, how about using Xcode? On Jun 10, 2008, at 2:07 PM, Kent Johnson wrote: On Tue, Jun 10, 2008 at 1:30 PM, Michael yaV [EMAIL PROTECTED] wrote: Thanks. What do you think of IDLE? It's primitive. Kent I agree with Kent. IDLE is bare bones. It's nice to mess around with the interactive interpreter, but I've been using Ipython for that. I've never played with Xcode. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Why not to use include?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Langford Sent: Sunday, June 08, 2008 2:39 PM To: Dotan Cohen Cc: tutor@python.org Subject: Re: [Tutor] Why not to use include? Python makes web pages just fine. There are both embedded technologies (such as the python server pages Kent mentioned above) and template engines based on callbacks (such as django's templates, djangos the whole way, etc). Its extremely easy to make your own templating engine if you don't like python server pages yet you like templating. (Using mod_python or mod_wsgi[recommended] and the substitute function). Other than a learning exercise or having a different idea about templating, I'd go with an existing template solution like Cheetah, Mako, Kid, Genshi. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Pythoncom Tutorial
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of FT Sent: Monday, May 19, 2008 12:04 PM To: Tutor Python ORG Subject: [Tutor] Pythoncom Tutorial Hi! I noticed that when wanting to learn Pythoncom there is no real good accessible tutorial for it. Does anyone know where a good structured tutorial exists for the Com utilities so I can write my own screen reader program? When trying to understand all the needed variables and such for the windows commands and variables it gets confusing. I want to learn how to get the objects and its methods so I can use a python program to read and verbalize the objects as you focus on them and such. The only explanations I found either have the descriptions scattered and no examples or structure on how to use any of the com stuff. How to use the Makepy and when not to use it. How to get the objects and its list of methods to be able to work with it for screen reading purposes. Thanks in advance. Bruce Python Programming on Win32 might help. There's also a couple of articles on OnLamp. http://www.oreilly.com/catalog/9781565926219/index.html Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Strip?
strip( s[, chars]) Return a copy of the string with leading and trailing characters removed. If chars is omitted or None, whitespace characters are removed. If given and not None, chars must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. Changed in version 2.2.3: The chars parameter was added. The chars parameter cannot be passed in earlier 2.2 versions. What characters are included as whitespace characters? Spaces? Tabs? Newlines? For some reason, I was reading whitespace as just spaces. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] string from input file
-Original Message- On Behalf Of Bryan Fodness Sent: Tuesday, April 29, 2008 3:54 PM To: tutorpythonmailinglist Python Subject: [Tutor] string from input file I am trying to get values from an input file, 0.192 Custom 15 IN but, when I check to see if they are equal it is not true. f = open(infile, 'r') s = f.readlines() f.close() Block = str(s[1]) Angle = float(s[2]) Position = str(s[3]) if Block == 'Custom': print 'equal' if I print Block+'Custom', I get, Custom Custom when I would have expected CustomCustom Can someone help me figure out if I am not reading the values in correctly, is there a control character at the end? The float value is ok. Your string has a line ending in it, so it doesn't match. It's essentially Custom\n. Just use a slice to remove the line ending character(\n). Also, I don't think you need to convert s[1] to a string. I think it's already a string. Block = s[1][:-1] In [1]: x = Custom\n In [2]: y = x[:-1] In [3]: y Out[3]: 'Custom' Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Open Source Hero my @$$!
-Original Message- On Behalf Of Marc Tompkins Sent: Wednesday, April 23, 2008 7:27 PM To: python tutor; [EMAIL PROTECTED] Subject: [Tutor] Open Source Hero my @$$! Just thought I'd share something I found quite humorous... a while back, I heard about Microsoft's Open Source Hero program, and being a curious type I signed up. Hey, I love me some Open Source, and I wanna be a hero, right? My Hero Pack arrived a few days ago. It contains: a 90-day trial of Visual Studio 2008 and a 120-day trial of Windows Server 2008. Now don't get me wrong - I'm not ungrateful; I fully intend to try out Windows Server so I can see what I'll be facing over the next few months. But Visual Studio? Open Source? Am I missing the joke here? Any other Heros here? Anybody else find this as funny as I did? I guess you can write open source software for 90 days using Microsoft's proprietary VS 2008. At least you can then try out IronPython or Python for .NET. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] knowing when a list is updated by a thread
Evey time someone recommends Queue I think oh boy this will really help me. Then I go to the Library Reference, read the Queue docs and think oh boy who can help me understand this. Even the sample code is confusing. Is there some other documentation or example? -- Bob Gailer http://effbot.org/librarybook/queue.htm Here's a direct link to the queue module. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] knowing when a list is updated by a thread
Evey time someone recommends Queue I think oh boy this will really help me. Then I go to the Library Reference, read the Queue docs and think oh boy who can help me understand this. Even the sample code is confusing. Is there some other documentation or example? -- Bob Gailer http://effbot.org/zone/librarybook-index.htm That might help. It looks like it has some example code. Look at the Threads and Processes link and search for queue. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Hoping to benefit from someone's experience...
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Tompkins Sent: Saturday, April 19, 2008 1:46 PM To: tutor@python.org Subject: Re: [Tutor] Hoping to benefit from someone's experience... As you might expect, most of the time is spent in Word. It would probably be faster if I set Visible = False, but for some reason the macro fails (silently) when I do that, so I just minimize Word instead to cut down on screen refreshes. Also, drive U is a Samba share, so there's network latency to take into account. Even so, 10,231 files took less than 15 minutes to convert, which I can live with. This isn't Python related, but it might help those who do Word macros. I think you can use Applications.ScreenUpdating = False at the beginning of your macro. The macro will run a bit faster. It's essentially hiding all the updating to the document(s). You should set it back at the end of your macro: Application.ScreenUpdating = True. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] web programming tutorials?
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Che M Sent: Thursday, April 17, 2008 9:21 PM To: tutor@python.org Subject: [Tutor] web programming tutorials? [I thought I sent a similar msg to this list 2 days ago, but now I'm not sure it went through, so sorry if I've doubled] Can someone point me to a start-from-dead-scratch tutorial about the basics of web programming? I've been learning wxPython for GUI programming, but web programming (that is, making web applications) seems like another world entirely. I'm aware of *names*--Django, Pylons, CherryPy, TurboGears, Zope, Webpy, etc.--but I have a poor sense of what all this means, and so I am sort of 'pre-Python' in my understanding. I've scanned the archives of this list, but so far haven't found pointers to tutorials that assume very little knowledge. I was kind of hoping Alan Gauld's project would be updated for the tempting but not yet existent section on web programming. Any word on that, Alan? In lieu of that, can anyone recommend books/online tutorials/words of advice? Thanks, Che IMHO, I think before anyone jumps into using a framework, they should understand the basics of cgi programming. Maybe do just a small exercise with simple form processing. After that exercise, then move on to one of the frameworks that make a lot of that grunt work easier. Jumping into a framework right away is like trying to run before you can crawl. There's a lot going on with the many frameworks(URL mapping, templates, ORM, persistence...). When you have some basic understanding of web programming, it might help you figure out why something isn't working properly in the framework. I'm curious about other tutor list member's thoughts on this. Am I out to lunch on this viewpoint? Anyway, here's a link to a python cgi tutorial: http://www.devshed.com/c/a/Python/Writing-CGI-Programs-in-Python/ Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Reading Multiple Files in Sequence
[mailto:[EMAIL PROTECTED] On Behalf Of Kelvin Gorospe Sorry, I need to stop doing this... Attached is the script that I forgot to attach in my last email to the list. Thanks again, K On Fri, Apr 18, 2008 at 11:22 AM, Kelvin Gorospe [EMAIL PROTECTED] wrote: Hi everyone, I'm new to Python AND programming and would appreciate any help anybody has to offer. I have several .csv files that contains temperature data taken at several different locations. Each line in the csv file is a list such as this: timestamp at location 1, temperature at location 1, timestamp at location 2, temperature at location 2, etc. The attached script opens one file and creates an output file that lists all the timestamps and temperatures for location 1. However, what I'd like to do, is have a script that SEVERAL csv files (each one containing one month of temperature data) and create an output file for EACH location (approximately 50 of them). So in the end, I'll have 50 txt files showing time stamps and temperatures for a single location over all months of data collection. Thanks in advance for your help. -Kelvin H. first, I'd use the CSV module instead of manually parsing the csv files. Although it might be ok in your application, sometimes you can get killed by CSV files that have commas as part of the data. Example: zone 1, 90, Hansen, Mike, 555 Elm Street, MayBerry, 555- Just splitting on commas will give you unexpected results since it will catch the stuff between the quotes. The CSV module handles this. Second, if you want to grab all csv files in a directory, you can use the glob module. Then you can iterate and read each csv file. Finally, the tricky part. There are a few ways of collecting the data for each location. If there isn't a huge amount of data, then you could load it into a in-memory data structure like a dictionary with each key being the location and the value being a list of tuples or a list of class instances, or a dictionary of dictionaries. Example of dictionary with a list of tuples: { location1 : [ (200804181611, 55), (200804171625, 42) , ...], location2 : [ (200804150800, 35)] } Then you could iterate over each dictionary key and write out your text file for that location. Another way would be to load the data into a database. Python 2.5 comes with SQLite. You could create one database table with columns for location, time, and temp. Then you can query the database for each location. I wouldn't open a file for each location while parsing the CSV files. To me it seems ugly to have up to 50 files open at once. I'm sure there are other ways that some of the more experienced tutor list members can suggest. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] datetime module problem
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dick Moores Sent: Thursday, April 17, 2008 2:21 PM To: Python Tutor List Subject: Re: [Tutor] datetime module problem At 06:29 AM 4/17/2008, Kent Johnson wrote: Dick Moores wrote: You could either create n with hours=minutes=0, or round the difference up to the next whole number of days. I have no idea how to implement either of your suggestions as to how to eliminate it. Could you please spell them both out? 1. In [17]: n=datetime.today() In [18]: n=datetime(n.year, n.month, n.day) In [19]: n Out[19]: datetime.datetime(2008, 4, 17, 0, 0) 2. In [20]: diff=y-n In [21]: diff Out[21]: datetime.timedelta(0, 57464, 721369) In [22]: days = diff.days In [23]: if diff.seconds or diff.microseconds: : days += 1 : : In [24]: days Out[24]: 1 Thanks, Kent. So here's where I am now: http://py77.python.pastebin.com/f5da44111 The script calculates correctly, but note the output, lines 34, 39, 49, 53. Please show me how to print these in the form 4/17/2007. I've tried everything I could think of. Dick In [23]: import datetime In [24]: x = datetime.datetime.now() In [25]: x Out[25]: datetime.datetime(2008, 4, 17, 14, 24, 18, 447000) In [26]: x.month Out[26]: 4 In [27]: x.day Out[27]: 17 In [28]: x.year Out[28]: 2008 In [30]: print %s/%s/%s %(x.month, x.day, x.year, ) 4/17/2008 Does that help? There's probably another way to do it, but this seems to work. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Take if offline
Anytime someone posts in HTML, or posts without a subject, or accidentally hijacks a thread, or top-posts, or writes in caps, a couple of posters pop up and complain. Rather than posting to the entire list, I think it'd be best if you send your complaint directly to the offending user. I'd prefer to read about Python not read lessons in net/mail-list etiquette. Thanks, Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Take if offline
h!!! You posted in HTML and top posted! OH NO! I top-posted too! runs away screaming and bouncing off the walls like Daffy Duck _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fiyawerx Sent: Tuesday, September 25, 2007 6:45 PM To: Darren Williams Cc: tutor@python.org; Shawn Milochik Subject: Re: [Tutor] Take if offline It also seems, for people like me, I've learned a lot of 'what not to do' by seeing peoples replies to others posts telling them.. well, what not to do. If all these were taken 'off list' you'd have a whole lot more people doing bad things because they wouldn't have seen yet not to do it, not to mention a whole lot more people having to send 'off-list' complaints to people, due to the same reason. On 9/25/07, Darren Williams HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: All jokes aside now (glad you took it that way Mike). Maybe I havn't gave the tutor enough attention, but I have never witnessed someone jump down anothers throat because they posted in all caps, didn't enter a subject etc... etc... The one time I have seen an argument (well heated debate) was about a subject entitled 'Losing the expressiveness of C' (or something similar), which I found pretty interesting. - Original Message - From: Shawn Milochik HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED] To: Darren Williams HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED] Sent: Tuesday, September 25, 2007 3:06 PM Subject: Re: [Tutor] Take if offline No, not really. He had to give everyone the rule once. Otherwise, he'd have to do it a hundred times a day, and monitor every single post to find out who he had to inform. He'd end up doing not much else with his life, and would flee to a monastery and give up coding forever. You wouldn't want that to happen, would you? On 9/25/07, Darren Williams HYPERLINK mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: So by your own rules, you should have sent that to the offending user(s). - Original Message - From: Hansen, Mike HYPERLINK mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] To: python tutor HYPERLINK mailto:tutor@python.orgtutor@python.org Sent: Tuesday, September 25, 2007 2:27 PM Subject: [Tutor] Take if offline Anytime someone posts in HTML, or posts without a subject, or accidentally hijacks a thread, or top-posts, or writes in caps, a couple of posters pop up and complain. Rather than posting to the entire list, I think it'd be best if you send your complaint directly to the offending user. I'd prefer to read about Python not read lessons in net/mail-list etiquette. Thanks, Mike ___ Tutor maillist - HYPERLINK mailto:Tutor@python.orgTutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - HYPERLINK mailto:Tutor@python.orgTutor@python.org HYPERLINK http://mail.python.org/mailman/listinfo/tutorhttp://mail.python.org/ma ilman/listinfo/tutor -- Please read: http://milocast.com/2007/07/31/this-i-believe/ ___ Tutor maillist - HYPERLINK mailto:Tutor@python.orgTutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor