[Tutor] Data Directory under site-packages

2010-11-10 Thread Greg Lindstrom
Hello,

I'm writing my first module that I intend to put under our company's 
"site-packages" directory for everyone to use in their programs.  The problem 
I'm having is that I want to place files in a data directory under the module 
directory (under site-packages) and I don't know how to set the path so I pick 
up the files.  If I use open('./data/myfile') I get the path of the file 
importing the module (which could be just about anywhere).  I've tried various 
combinations using os.path.abspath() and os.path.dirname() but have the same 
problem.  Is there a way I can use files in the subdirectory (I really do not 
want dozens more files in the main directory)?

Thanks for your help,
--greg



CONFIDENTIALITY NOTICE:  This communication contains information 
intended for the use of the individuals to whom it is addressed 
and may contain information that is privileged, confidential or 
exempt from other disclosure under applicable law.  If you are 
not the intended recipient, you are notified that any disclosure, 
printing, copying, distribution or use of the contents is prohibited.  
If you have received this in error, please notify the sender 
immediately by telephone or by returning it by return mail and then 
permanently delete the communication from your system.  Thank you.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2010 - Call for Tutorials

2009-09-05 Thread Greg Lindstrom
The Tutorial Committee for PyCon 2010 in Atlanta is now accepting proposals
for classes.  This year will feature 2 days of classes prior to the
"official" conference.  These classes are 3-hour long sessions concentrating
on specific Python packages or techniques and are taught by some of the
smartest cookies in the Python Universe.  Anything Python may be submitted
for consideration but there are a limited number of sessions to be filled.
Topics taught or requested over the past two years include:

* Python 101 - An introduction to programming Python, either for complete
beginners or programmers experienced in other languages.

* Python 201 - There has been repeated requests for classes covering
"intermediate" topics; data structures, database techniques,
classes/objects, standard library, eggs, etc.

* Python 401 - Classes covering "advanced" topics;
multi-processing/concurrency, iterators/generators, OOP, etc.

* Web Topics - Frameworks, web testing, design, security, scraping.

* Scientific Python - MatLab, SciPy

* Testing - Frameworks, methods

* GUI - Dabo, wxPython, TkInter, etc.

*  More: XML, GIS, SQLAlchemy, Jython, System Administration

More information, including a sample proposal and blank template, are at
http://us.pycon.org/2010/tutorials/proposals/.

Questions?  Email us at pycon-tutori...@python.org.

Greg Lindstrom
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2010 (Atlanta) Call For Tutorials

2009-09-17 Thread Greg Lindstrom
The period to submit proposals for PyCon 2010 in Atlanta is open until
October 18th.  Tutorial are held the two days prior to the main conference
and feature 3-hour classes led by fellow Python developers and
enthusiasts *just
like you*.  Any topic relating to Python is allowed and the organizers
encourage anyone who wants to share their knowledge to submit their ideas
for consideration.  Perennial classes include "Introduction to Python" for
various audiences (beginners, programmers, those new to Django and web
frameworks, etc.), intermediate Python (standard library, module/packages,
objects, etc.) and more specialized topics (SciPy/Matlab, unit and web
testing, optimization) as well as general topics such as "Best Practices"
for web programming, objects, libraries.  There is even interest in a class
to show how to organize, design, write and distribute an Open Source
project.  Any topic relating to Python is eligible.

Tutorial teachers are paid $1,000.00 per class for their efforts.

Interested (we hope so!)?  More information is available at
http://us.pycon.org/2010/tutorials/proposals/  or write us at
pycon-tutori...@python.org.

We look forward to hearing from YOU.

Greg Lindstrom
Tutorial Coordinator, PyCon 2010 (Atlanta)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Resources

2005-05-13 Thread Greg Lindstrom
Hello-

I have been asked to write an article for the IEEE "IT Pro" magazine 
dealing with using Python in the medical field.  The editors asked for 
about half the article dealing with using Python and the other half 
giving a short tutorial.  They also asked for three "sidebars"; I'm 
going with Tim Peter's "Zen of Python" for one, a comparison of "Hello, 
World", in C, C++, Perl, and Java in the second, and for the third I 
would like to list some resources.  I have the Python home page, "Dive 
Into Python", the Python Gems" page, but would like to ask what 
resources would any of you suggest?  I'd like  between 5 and 10, with a 
short description of each.

The article emphasizes the simple syntax of Python and the friendliness 
of our community.  It encourages anyone interested in learning to 
subscribe to this mailing list and ask questions (though I do caution 
them not to submit their homework simply to get a solution).

I have asked two people to review the paper from a "Python" perspective 
to make sure I have not mis-represented the language (I'm sorry about 
the delays, Steve, but the paper is coming!).  If any of you would like 
to review it, I would be happy to send you a copy, too.  I have about a 
week before submission.

Thanks for your help,
--greg


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] For Loop Exercises

2005-05-31 Thread Greg Lindstrom
>I finished the chapter which includes for loop, tuples, indexing and
>slicing. Can anyone suggest me 3 exercises to remind of the chapter?


A great place to find all sorts of programs to write -- from very easy
to complex -- is the programming contest archive on the useless python
page (www.uselesspython.com).  Pick a couple and you will have all
sorts of chances to use everything mentioned above.

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Building an SQL query

2005-06-02 Thread Greg Lindstrom
Hello-

I am building a query to hit a Postgres (8.0.1) database from Python
(4.2.1) on Linux.  Here's how I've been doing it for the past
year or so:

data = "">
data['start_date'] = '2005-6-2'
data['last_name'] = 'Johnson'

query = '''
   SELECT * 
 FROM my_table
    WHERE date >= '%(start_date)s'
  AND last_name = '%(last_name)s'
''' % data
results = my_database.Execute(query)

and life has been good.  What I would like to do now is use the Postgres "IN" operator.  For example:

ids_to_process = ('1','2','3','5','7','11')

I would like to get something akin to:

query = '''
  UPDATE my_table 
 SET state = 'processed' 
   WHERE id IN ids_to_process
'''

This would, of course, set the 'state' column to 'processed' for all of
the ids in the list, but can not figure out how to get this into a
query to pass to the database.  Have any of you smart cookies out
there dealt with this?  There are other ways to get the job done,
worst case being writing a look and issuing an UPDATE for each id, but
that is not too elegant, IMHO.

Any help or pointers would be greatly appreciated,

--greg

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building an SQL query

2005-06-02 Thread Greg Lindstrom
On 6/2/05, Alan G <[EMAIL PROTECTED]> wrote:
Its a really bad idea to use SELECT * FROM in production code.There are two main reasons:1)
If the database structure changes your code is likely to break since
SELECT * does not normally guarantee anything about the order of fields
returned, so if the table gets an extra field added you might find the
order changing. At the very least there will be an extra item in your
tuple ofvalues returned whichj may well break your code.

Alan, 

I'm using SELECT * specifically for this reason!  I have the
query and customer specific data layouts stored in a database and am
using ADOpy to associate the field names to locations in a data
segment.  Doing it this way allows us to modify the query and/or
the layout in the database without touching the code that does all of
the heavy lifting.  Using this strategy, we are able to perform
all of our extractions to customer specific layouts with one rather
small Python routine (this was the topic I spoke on at PyCon 2005) and
with the web pages we've created our non-technical personnel can
create/modify customer layouts.  It started off as a project to do
our daily data pulls but has grown to handle virtually every report we
generate.

2)
Using * also prevents the database from precompiling your query and
caching it, thus you will slow down the processing by forcing a SQL
compile step each time. (This is true on Oracle, DB2 and
Interbase,  don't know about Postgres but assume it is similar)
You are correct and in the future this may be a problem but currently
we will accept the time penalty to gain the flexibility described above.
> query = '''> UPDATE my_table> SET state = 'processed'> WHERE id IN ids_to_process
> '''What have you tried? What happened? It should just be a caseof using variable interpolation as you did for the Select.
Here's what works for me (and a tip-o-the-hat to Bob Gailer for his help)

query  =  '''UPDATE my_table SET state = 'processed'  WHERE id IN %s''' % str(ids_to_process)
query = query.replace('[', '(')
query = query.replace(']', ')')
results = adocursor.Execute(query)

Notice that I have to replace [ with ( and ] with ).  A small
bother but the results are allowing me to perform much more complex
queries out of the database.  I'm always open to ways to improve
this (in particular I would like to avoid recompiling the query every
time this is hit).  It just hit me that we could store the field
names to select in the query right along with everything else...I think
I'll try it to see what sort of increase we get because we plan on
growing our business.

Thanks for responding,
--greg
 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Building an SQL query

2005-06-02 Thread Greg Lindstrom

Hmm, I dunno ADOpy but assume it somehow miraculously turns your dataset into a dictionary of some sort? How it guesses which order the
SELECT will return the fields is a mystery to me, but maybe it hasknowledge of the Postgres hashing function or somesuch.
 
Yeah.  I used to do it by hand by looking at the description of the cursor object, which holds the name of each field as defined in the database with other stuff.  You can then get the field value by getting the index of the field name, then hitting the row data.  It's not a lot of fun, but I did it because I didn't want to depend on the order being returned in case we wanted to drop a field for some reason.

 
> Here's what works for me (and a tip-o-the-hat to Bob Gailer for hishelp)>> query = '''UPDATE my_table SET state = 'processed' WHERE id IN %s'''%> str(ids_to_process)> query = 
query.replace('[', '(')>Why not convert the list to a tuple before applying str():>str(tuple(ids_to_process)) 
 
Didn't think of it...thanks :-)>Unless ADOpy is very slow I wouldn't expect a huge performance>increase since it will only be the compile phase, but if you>hit the query a lot then maybe 5-10%. You are more likely to
>see the benefit in a drop CPU loading on the server. 
 
Which is good, too. 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 16, Issue 7

2005-06-02 Thread Greg Lindstrom

>data = "">>data['start_date'] = '2005-6-2'>data['last_name'] = 'Johnson'>>query = '''
>SELECT *>  FROM my_table> WHERE date >= '%(start_date)s'>   AND last_name = '%(last_name)s'>''' % data>results = my_database.Execute(query)First up. This is a "bad idea".
It may be ok now, as long as you have absolute controlover what start_date and last_name are, but what aboutnext week when you decide ... "let's allow the user to putin the dates for start_date" and they make start_date
"'6-2-05'; DELETE FROM my_table; SELECT * FROM my_tableWHERE date='6-2-05' "Instead, use the arg quoting mechanism from the dbinterface you are using. You don't say which one thatis, but it should look something like ...
data = "">data['start_date'] = '2005-6-2'data['last_name'] = 'Johnson'query = '''   SELECT * FROM my_tableWHERE date >= '%(start_date)s'  AND last_name = '%(last_name)s'
'''results = my_database.execute(query, data)
 
Very nice.  Thank-you.
--greg 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Deleting an entry from a dictionary

2005-08-02 Thread Greg Lindstrom
Hello-
This must be simple, but for the life of me I can't figure out how to 
delete an entry from a dictionary.  For example,

meals = {}
meals['breakfast'] = 'slimfast'
meals['lunch'] = 'slimfast'
meals['dinner'] = 'something sensible'

How do I eliminate 'lunch' from the dictionary so that I only have 
'breakfast' and 'dinner'?

Thanks!
--greg

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Properties

2007-06-07 Thread Greg Lindstrom

Hello, and I apologize in advance for the question.

I have decided to publish a class I use to handle data segments to Google
Code for the world to see (I plan to make millions off training classes,
books and lectures :-).  I need to make it a bit more 'generic' than the
class I have been using, and while I'm working the rewrite I thought it
would be cool to add unit tests and use properties.  The problem is, I only
recall that properties are 'cool'.  I can't locate the documentation on why
or how to use them.  If you could point me to the proper documentation I
would be most appreciative.

Also, I plan to use unittest to write my unit tests.  Is this module still
considered acceptable, or has something else taken it's place?

Thanks for your help,

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Creating Packages

2007-07-18 Thread Greg Lindstrom

Hello-

I have written a class to help folks like me manipulate data segments (the
kind one deals with when reading/writing data files).  The classes and tests
are written -- at least enough to get things going -- what I need help with
is creating a package out of this and then creating routines to install
them.  Can one of you help me out either with some tutoring or pointing me
to some literature?  I would like to use the cheese shop.

Thanks for your help,

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Running Python on Gentoo

2007-07-26 Thread Greg Lindstrom
Eric Brunson wrote:
>
> What does the command "which python" say?
[EMAIL PROTECTED] ~ $ which python
/usr/bin/python

HTH,
--greg


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Running Python on Gentoo

2007-07-26 Thread Greg Lindstrom
Hello,
I am running python 2.4.2 on Gentoo Unix and am having problems running 
programs.  I have a script, hello.py as such:

#! /usr/bin/python
print 'hello, world'

that I save and add executable permission.  Then at the prompt I type in..

$ ./hello.py
-bash: ./hello.py: /usr/bin/python: bad interpreter: Permission denied

If I type
$ python hello.py
I get "hello, world" as expected.

I was hoping that the "shabang" would have the script execute.  Am I 
missing something?  Can you help me?  BTW, when I type /usr/bin/python 
at the prompt I get the python interpreter, so at least that's working.

Thanks,
--greg

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I execute a PL/SQL Procedure directly through

2007-07-30 Thread Greg Lindstrom
>Can anybody help me in how to connect Python to oracle and then to execute
>an already existing PL/SQL Procedure through Python.

What platform are you running?  Windows?  Linux?  Mac?

I've used Oracle and plSql for years and will be happy to help out once I
know what you need.

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I execute a PL/SQL Procedure directly through

2007-07-30 Thread Greg Lindstrom
My Oracle connection is set up using the adodb module (
http://adodb.sourceforge.net/).  I don't remember why we set it up that
way...we haven't touched this part of our code for almost 2 years!.

from cx_Oracle import makedsn
import adodb

db = adodb.NewADOConnection('oci8')
connection_string = makedsn(ip, port, database)   <== your values here, of
course
db.Connect(connection _string, username, password)  <== and here, too

query = "SELECT name_of_pgSQL_routine(%(argument1)s, %(argument2)s)"
results = db.execute(query, locals())

and go from there.  Let me know if yo have other questions.

HTH,

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I execute a PL/SQL Procedure directly through

2007-07-30 Thread Greg Lindstrom
On 7/30/07, Amit Saxena <[EMAIL PROTECTED]> wrote:
>
>
> I m still not able to run a Procedure
>
> from cx_Oracle import makedsn
> import adodb
>
> db = adodb.NewADOConnection('oci8')
> connection_string = makedsn("10.200.91.27 ", 1521, "scorpio")   #<== your
> values here, of course
> db.Connect(connection_string, "kcmdev", "devkcm")  #<== and here, too
>
> #query = "SELECT * from USER_ROLE where ROLE_FK = 29"
> results = db.Execute("metadata.sql")
> print results
>
>
> is giving an error saying
>
> Traceback (most recent call last):
>   File "D:/Python/sql.py", line 9, in 
> results = db.Execute("metadata.sql")
>   File "C:\Python25\Lib\site-packages\adodb\adodb.py", line 274, in
> Execute
> c = self._query(sql,params)
>   File "C:\Python25\Lib\site-packages\adodb\adodb.py", line 265, in _query
>
> raise sys.exc_info()[0] ,str(err)+': '+sql
> DatabaseError: ORA-00900: invalid SQL statement
> : metadata.sql
>

What is in metadata.sql?  If it is a PL/SQL query, then you should "SELECT
metadata()".  If is a file containing sql (is the pl/sql you wish to execute
in this file?) then I'm not sure how to proceed.

Is the PL/SQL you wish to run saved in Oracle?  Can you show us what's in
the metadata.sql file?

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How can I execute a PL/SQL Procedure directly through

2007-07-30 Thread Greg Lindstrom
I've never tried anything like that before; others may be of more help at
this point.  What I would try is reading the contents of the file into a
local variable.

my_data = file('metadata.sql').readlines()   # read the file into a list
query = ''.join(my_data)   # append the list into a
single string (including linefeeds)

results = db.execute(query)

That should -- though I haven't tried it -- run the script to create the
stored procedure.  You would then call it via a SELECT statement to capture
the results of running the sproc.

ado allows you to set "debug" to 1 and it will echo your queries back to you
as you execute them.

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2008 - Call for Tutorial Ideas

2007-08-16 Thread Greg Lindstrom
Hey Everyone-

I posted this to the python list, but then thought the tutor list might be a
better place to get ideas.  So

It's hard to believe, but the planning for PyCon 2008 is underway.  PyCon,
an annual gathering of Python enthusiasts -- nearly 600 in Dallas last year
-- will be held in Chicago next March 14-16, with one full "pre-conference"
day, March 13, set aside for tutorials; classes given by Python honchos on
various topics.  These sessions last 3 hours (plus a break) and in general
are more detailed than the talks given during the actual conference.  Right
now, we need to know what YOU want to see covered in these sessions.
 Testing, GUI, web-apps, database, basic Python, advanced Python, objects,
anything and everything Python is on the table at this point.  We have to
narrow the field down to 10 or 15 and then find qualified presenters, so now
is the time to start gathering ideas.

What tutorials would YOU like to see offered?  Please response to:
[EMAIL PROTECTED]

Thanks,

Greg Lindstrom
Tutorial Coordinator, PyCon 2008
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2008 - Call for Tutorial Topics

2007-09-01 Thread Greg Lindstrom
Hello All,

We are still soliciting ideas for tutorials to put on at PyCon in Chicago
next spring.  PyCon is all about our community; under the direction of the
PSF, planned, organized and run by volunteers just like you.  We are asking
for topics that you want to see covered on the tutorial day (the day
preceding the "official" conference).  There is an additional charge for
these classes but they are taught by instructors who really know their
topics.  The following ideas have been requested (nothing has been
scheduled, yet):

   - Testing strategies
   - Intermediate Python
   - Database
   - How to "think" in Python 3000
   - Using Cheeseshop
   - SOAP/.Net (Iron Python?)
   - Programming Contest

We need more ideas before we start putting things together.  What do *you*
want to see?  This is your chance to learn from the experts (or, maybe,
*you* would like to present a class).

Let me know what class would entice you to attend the tutorials.

Greg Lindstrom
Tutorial Coordinator, PyCon 2008
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Fwd: [pycon-tutorials] Request: Python Instruction Needed for GIS Symposium

2007-10-30 Thread Greg Lindstrom
We received this on the PyCon tutorial list.  Anyone interested??

Thanks,
--greg

-- Forwarded message --
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Oct 30, 2007 11:18 AM
Subject: [pycon-tutorials] Request: Python Instruction Needed for GIS
Symposium
To: [EMAIL PROTECTED]


I sent out the following hoping to get a Python Instructor for an April 2008
GIS Symposium in Kansas City.  If you would be so kind, please consider
forwarding it to your list of folks who may be giving tutorials at your
Chicago Conference.   We would be glad to do a little advertising for you in
return:

I am involved with MAGIC  http://www.magicgis.org/   an organization to
encourage GIS development, sharing, cooperation, etc. and educate
practitioners in GIS.  We hold a symposium every two years in April (next is
April 2008) and provide speakers and workshops in relevant GIS subjects.
ESRI's ArcGIS software holds  the market majority and has embrace Python
language as a preferred scripting, customization language.One area we
have trouble with for our symposium is  getting instructors for Python
workshops.   The symposium is in Kansas City on April 20-24, 2008 and the
hands on computer based Python course would be held for 4 hours on Sunday
April 20th in the afternoon for about 30 beginner and intermediate
programmers.   We would like some application to ArcGIS, but just basic
Python language instruction is also needed.  The instructors and speakers as
well as the planning committee are asked to volunteer to keep the cost down
to symposium attendees.Would you be a good fit (or know anyone) as an
instructor for this Introduction to Python language course?

The Symposium Steering Committee would like to get a commitment by Nov. 2,
2008 in order to publish a preliminary program.   Sorry for the short
notice, we thought we had an instructor but do not.   We need a short 1-2
paragraph summary or outline of the workshop by then.I am willing to
help develop any materials needed.

Contact me by phone or email if you have questions or would like to
volunteer.   Thanks.

Eric Foster, Senior Transportation Planner
MoDOT, 600 NE Colbern Rd. Lee's Summit, MO 64086
(816) 622-6330


___
pycon-tutorials mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/pycon-tutorials
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutorials at PyCon 2008 (US)

2008-01-07 Thread Greg Lindstrom
Hello Everyone-

I'd like to announce the tutorials sessions for PyCon 2008 (US).  As you may
know, this year PyCon is being held in Chicago, Illinois March 14-16 with
the Thursday before (the 13th) being "Tutorial Thursday".  We are expecting
nearly 600 Python enthusiasts to meet up for the conference and have 29
tutorial sessions scheduled on Thursday in three sessions; morning,
afternoon, and evening.  There is an extra fee to attend a tutorial, but the
sessions are 3 hours long (with a break) and are taught by some of the
smartest cookies in the Python community.  Pop on over to
http://us.pycon.org/2008/about/ for more information

Here's a list of the sessions currently offered (we may cancel a session if
there are fewer than 10 people registered, but that doesn't happen very
often). In particular, note that there are 4 different introduction to
Python tutorials aimed at different audiences.

*Morning Session* (9:00am-12:20pm)

   - Eggs and Buildout Deployment in
Python(Jeff Rush)
   - Python 101 for
Programmers(Steve
Holden)
   - Introduction to
SQLAlchemy(Jonathan
Ellis and and Michael Baye)
   - Python plotting with matplotlib and
pylab(John Hunter)
   - SWIG Master Class
(David Beazley)
   - Secrets of the Framework
Creators(Feihong
Hsu)
   - Introduction to
NumPy(Travis Oliphant
and Eric Jones)
   - Making Small Software for Small People, Sugar/OLPC Coding by
Example(Mike C.
Fletcher)
   - Hands-on Python for the Absolute Beginner
I(Dr. Andrew
Harrington)

*Afternoon Session* (1:20pm-4:40pm)

   - Python 101
(Stuart
Williams)
   - Getting Started with Pylons/TurboGears2 & WSGI: Modern Python Web
   Development  (Mark
   Ramm and Ben Bangert)
   - Advanced 
SQLAlchemy(Jonathan
Ellis and and Michael Baye)
   - Django Tutorial
(Jacob Kaplan-Moss)
   - wxPython I: Intro to GUI Programming with wxPython and
MVC(David
Goodger)
   - Faster Python Programs through Optimization and Extensions
I(Mike
Müller)
   - Tools for Scientific Computing in
Python(Travis
Oliphant and Eric Jones)
   - Generator Tricks for Systems
Programmers(David
Beazley)
   - Basic Python for Java
Programmers(Alex
Martelli and Anna Ravenscroft)
   - Hands-on Python for the Absolute Beginner
II(Dr.
Andrew Harrington)

*Evening Session* (6:10pm-9:30pm)

   - Python 102
(Stuart
Williams)
   - Mastering Pylons and TurboGears 2: Moving Beyond the
Basics.(Mark Ramm,
Ben Bangert)
   - Practical Applications of Agile (Web) Testing
Tools(C. Titus
Brown and Grig Gheorghiu)
   - Django Code Lab
(Jacob Kaplan-Moss,
Adrian Holovaty and James Bennett)
   - wxPython II: Advanced GUI Programming with wxPython and
MVC(David
Goodger)
   - Faster Python Programs through Optimization and Extensions
II(Mike
Müller)
   - Automating Windows Applications with
win32com(Roy H.
Han)
   - Internet Programming with
Python(Wesley
J. Chun)
   - Tail Wags Fangs: What Python Developers Should Know About
Plone(Rob Lineberger)
   - Pygame: Modern game
development(Noah
Kantrowitz and Marc Destefano)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2008 Tutorial Sessions

2008-02-03 Thread Greg Lindstrom
Registration for PyCon 2008 is now open.  Held in Chicago March 14-16 with
"Tutorial Thursday" on March 13 and sprints afterwards, it is expected that
nearly 800 Python enthusiasts will attend at least part of the conference.
It is totally run by volunteers and is affordable for just about anyone.  I
would like to point out the tutorial sessions being offered; all the way
from "Python for the Absolute Beginner", to advanced courses on optimizing
Python programs (with 27 more classes in between).  Click on over to
http://us.pycon.org/2008/about/  for information about the conference.  Here
is a list of the classes being offered along with the instructors scheduled
to present the classes (click to get more information on a session).  It's a
great way to learn more Python.

*Morning Session* (9:00am-12:20pm)

   - Eggs and Buildout Deployment in
Python(Jeff Rush)
   - Python 101 for
Programmers(Steve
Holden)
   - Introduction to
SQLAlchemy(Jonathan
Ellis and Michael Bayer)
   - Python plotting with matplotlib and
pylab(John Hunter)
   - SWIG Master Class
(David Beazley)
   - Secrets of the Framework
Creators(Feihong
Hsu and Kumar McMillan)
   - Introduction to
NumPy(Travis Oliphant
and Eric Jones)
   - Making Small Software for Small People, Sugar/OLPC Coding by
Example(Mike C.
Fletcher)
   - Hands-on Python for the Absolute Beginner
I(Dr. Andrew
Harrington)

*Afternoon Session* (1:20pm-4:40pm)

   - Python 101
(Stuart
Williams)
   - Getting Started with Pylons/TurboGears2 & WSGI: Modern Python Web
   Development  (Mark
   Ramm and Ben Bangert)
   - Advanced 
SQLAlchemy(Jonathan
Ellis and Michael Bayer)
   - Django Tutorial
(Jacob Kaplan-Moss)
   - wxPython I: Intro to GUI Programming with wxPython and
MVC(David
Goodger)
   - Faster Python Programs through Optimization and Extensions
I(Mike
Müller)
   - Tools for Scientific Computing in
Python(Travis
Oliphant and Eric Jones)
   - Generator Tricks for Systems
Programmers(David
Beazley)
   - Basic Python for Java
Programmers(Alex
Martelli and Anna Ravenscroft)
   - Hands-on Python for the Absolute Beginner
II(Dr.
Andrew Harrington)

*Evening Session* (6:10pm-9:30pm)

   - Python 102
(Stuart
Williams)
   - Mastering Pylons and TurboGears 2: Moving Beyond the
Basics.(Mark Ramm,
Ben Bangert)
   - Practical Applications of Agile (Web) Testing
Tools(C. Titus
Brown and Grig Gheorghiu)
   - Django Code Lab
(Jacob Kaplan-Moss,
Adrian Holovaty and James Bennett)
   - wxPython II: Advanced GUI Programming with wxPython and
MVC(David
Goodger)
   - Faster Python Programs through Optimization and Extensions
II(Mike
Müller)
   - Automating Windows Applications with
win32com(Roy H.
Han)
   - Internet Programming with
Python(Wesley
J. Chun)
   - Tail Wags Fangs: What Python Developers Should Know About
Plone(Rob Lineberger)
   - Pygame: Modern game
development(Noah
Kantrowitz and Marc Destefano)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] cx_Oracle help

2008-02-05 Thread Greg Lindstrom
Hello,

I'm trying to help out a friend and am stumped.  Can you help me out?
Thanks,
--greg

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 I will briefly explain the problem I am facing.
 I am using Oracle 9.2, Python 2.5 and I installed cx_Oracle-
4.3.1-win32-9i-py25 in Python.

 From python I tried following :
 >>> import cx_Oracle
 >>> myDsn = cx_Oracle.makedsn('ISCN47',1521,'AUBDBS01')
 >>> CONN = cx_Oracle.connect(myusr, mypwd, myDsn)
Traceback (most recent call last):
File "", line 1, in 
   conn = cx_Oracle.Connection('scott','tiger',myDsn)
   RuntimeError: Unable to acquire Oracle environment handle

 I have set the below environment variables too
  NLS_LANG:  .WE8MSWIN1252
  ORACLE_HOME:D:\Tools\oracle\ora92
  ORACLE_SID:   AUBDBS01
  PYTHON_HOME:d:\Utility\Python25
  PYTHONPATH:
%PYTHON_HOME%\lib;%PYTHON_HOME%\DLLs;%PYTHON_HOME%\Lib\site-packages;%ORACLE_HOME%\bin
  LD_LIBRARY_PATH:   %LD_LIBRARY_PATH%;D:\Tools\oracle\ora92\lib

 Not getting any idea where I am wrong?

Regards,

Kishore
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Shut up and deal!

2005-08-08 Thread Greg Lindstrom
I found the conversation of dealing cards interesting, so I took a few
minutes (about 20 while I waited for a production run to finish) and
came up with the following Dealer class.  I come with a long
history of coding in C/C++ and have been told my code looks like it
(notice, in particular the nested "for" loops in the Shuffle
method).  What type of Pythonic changes would make this? 
What features would be nice?  This was just for fun, so let's not
take it too seriously!

--greg

- - - - Start Snippet - - - - - - - - - -
#!/usr/bin/python
from random import shuffle

class Dealer(object):
   # define your deck here
   SUITS = ('Spades', 'Hearts', 'Clubs', 'Diamonds')
   RANKS = ('2','3','4','5','6','7','8','9','10','Jack','Queen','King','Ace')

   def __init__(self, decks=1, suits=SUITS, ranks=RANKS):
   self.number_of_decks = decks
   self.suits = suits
   self.ranks = ranks
   self.Shuffle()

   def Shuffle(self):
   self.deck = []
   for deck in range(self.number_of_decks):
   for suit in self.suits:
   for rank in self.ranks:
  
self.deck.append('%s of %s'%(rank,suit))
   shuffle(self.deck)

   def Deal(self):
   '''Return the top card from the deck, or None if the deck is depleated'''
   if len(self.deck) > 0:
  card = self.deck[0]
  del self.deck[0]
  return card
   else:
  return None

###
### Unit Test #
###
if __name__ == '__main__':
   dealer = Dealer()
   for n in range(10):
   print dealer.Deal()

- - - - End Snippet - - - - -

Which yields:
    2 of Clubs
    7 of Diamonds
    9 of Diamonds
  Ace of Diamonds
 Jack of Hearts
 King of Hearts
    8 of Clubs 
 King of Clubs
    5 of Spades
    3 of Hearts



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 18, Issue 78

2005-08-19 Thread Greg Lindstrom
I want to unsubscribe from your python mailing list and anything relatedthat keeps sending un imagned amount of emails that anrt spam but a bit
of shit. pls Unsubscribe me.
If you're still subscribed, you may want to
switch over to the digest mode and only get a few emails a day. 
This is an active list, and should be.  Switching to "digest"
(click the link below and you'll be fine) should help.

Kind Regards,
--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Dynamic Function Assignment

2005-10-20 Thread Greg Lindstrom
Hello-

Suppose I have three objects...

a = MyObject(id=1)
b = MyObject(id=2)
c = MyObject(id=3)

As I read in segments from my file, I need to choose one of the above based on the segment, something like this;

segment = 'A Segment to Process'

for id, S in (('A',a), ('B',b), ('C',c)):
  if segment.upper().startswith(id):
    S.DoSomething(segment)

That is, I want to associate an object to work with a condition on the
input segment (there are dozens of segment types and very large files
to process).  But I'd like to clean up the "for" statement and
have something like this:

for id in ('A', 'B', 'C'):
   if segment.upper().startswith(id):
  ??how can I select the correct object here with a big "if" statement??

The routine works fine as is, but if I can clean up the syntax I will
be able to configure the application via a database; very attractive
because I can process all of the records with one fairly small (~500
line) routine.


Thanks for your consideration...
--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Re; Geometry

2005-11-07 Thread Greg Lindstrom
If there's not code for geometry, let's write some!!  What,
precisely, are you looking for?  Or, better yet, do you have the
resources to have you students write the code after teaching them "just
enough" python?  I did that with a physics class a few years ago
and the students loved it!

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Pretty XML

2005-11-23 Thread Greg Lindstrom
Hello-
I am in the process of creating an XML document from information stored
in our database.  One of my colleagues will use the record to
format our information (health care claims) into all sorts of forms,
reports, etc.  He is partial to PHP5 but I like Python and would
like to know if there is something that would read in my XML file and
format it in a similar manner to "pretty print" so I can verify the
correct information is being pulled.  I have looked into the XML
documentation and, to be honest, I am overwhelmed with the choices;
SAX, DOM, XPath, 4Suite, and more.  Though I've been coding full
time for 25 years, I'm new to XML and could use some pointers.

My immediate concern is to read in an XML stream from a file and format
it with indentation so that I can read and verify the data against out
database.  My long term concern is what tool(s) do you think would
give the biggest return against the effort required to learn
them?  The claim files I am generating will be less than a meg
each, if that matters.

Thanks!
--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Is this a good idea to improve my currency program?

2005-12-14 Thread Greg Lindstrom
>I was thinking of using a dictionary to hold the currency exchange rates,
>and saving it to a file, and loading it every time the program opens. It
>still would not be GUI, but it would be a step towards a better program, I
>believe. Is this a good idea, or is there stronger ways of doing it?

Is it possible to load your exchange rates in a database?  That
way changes can be made without opening up your code everytime.

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Decorators

2006-04-10 Thread Greg Lindstrom
Hello-For some reason I have decided to learn about decorators; I heard them talked up at  Pycon the past two years and want to know what all the fuss is about.  I might even use them in my code :-)My problem, and this is after reading PEP 318 and other items found when I "Googled" for decorators, is that I can't figure out the practical use for them.  This surely means that I do not understand the concept because Python does not waste my time or energy.  Can any of you gurus either explain what all the excitement is about or point me to examples of how/why I would want to use decorators?
Thanks for your attention...
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] failing to learn python

2006-04-10 Thread Greg Lindstrom
Paypal-

I do a lot of system admin type work with Python.  If you'd like,
drop me a line and let me know what you're interested in
learning...perhaps I could help you work through a project or two.

Greg Lindstrom
[EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Two Questions...(i) Checking for None (ii) Making

2006-11-05 Thread Greg Lindstrom
Date: Sat, 4 Nov 2006 10:36:58 +From: "Asrarahmed Kadri" <
[EMAIL PROTECTED]>Hi Folks,I am trying to build a program which takes the following command-line
arguments:   *-s  -D  -n  -t   time>*the first argument which is -s (for source) can be replaced by -d (fordestination) or -o (for observer) or -r (for reporter). Now what I want is
to make sure that the user only supplies one of the options from the 4alternatives.I am using 'optparse' module. It has got a nice feature taht enables you togive the option name, along with the variable-name to store the value of
that option. The syntax is as under:if you import sys you can use sys.argv to look at a list of all the command line arguments (including the programs filename).  You should be able to determine if you have duplicate flags ('-s','-d',etc).
hth--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Pinging a service

2008-06-12 Thread Greg Lindstrom
Hello,

I would like to write a routine to monitor services running on a
remote box. My initial thought is to "ping" the remote box to monitor
latency and then execute a query on the remote machine to monitor the
database. What I would like is to gather data points and graph the
delay to see if there are any patterns;

A) Is this a sound strategy?

B) Are there libraries for the "ping"ing aspect?  If not, I can
execute the ping using "command"...how can I capture the screen output
to get the times?

Thanks,

--greg
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] pyArkansas on October 4th

2008-09-03 Thread Greg Lindstrom
We are pleased to announce that pyArkansas will be held on the campus of
University of Central Arkansas  (www.uca.edu) on October 4th.  Scheduled
classes in the morning include Python 101 taught by Dr. Bernard Chen
(incoming faculty at UCA but having taught the course at Georgia State
University), "Python 201" taught by Jeff Rush (Dallas Python Users Group)
and Python for Unix/Linux Administration (Noah Gift teaching on his -- and
Jeremy Jones' -- newly released OReilly title).  The afternoon features
talks and a panel discussion along with lots of great give aways and swag.

Due to limitations of physical space we must close registration at 100
participants (in honor of my first OS, SunOS, we may go to 110).  Check out
our wiki at http://pycamp.python.org/Arkansas/HomePage.  There's no
registration fee, so if you're in the area stop on by...we are looking
forward to a great day.

Greg Lindstrom
Python Artists of Arkansas (PyAR^2)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2009 (US) - Call for Tutorials

2008-09-18 Thread Greg Lindstrom
*Pycon 2009 (US) – Call for Tutorials*

The period for submitting tutorial proposals for Pycon 2009 (US) is now open
and will continue through Friday, October 31th. This year features two
"pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday
March 26 in Chicago. This allows for more classes than ever.

Tutorials are 3-hours long on a specific topic of your choice. Last year we
featured classes on Learning Python, Web Development, Scientific Computing,
and many more. Class size varied from 10 to over 60 students. The extended
time spent in class allows teachers to cover a lot of material while
allowing for interaction with students.

The full Call for Tutorial Proposals, including submission details, an
example proposal as well as a template, is available at <
http://us.pycon.org/2009/tutorials/proposals/>.


Tutorial selections will be announced in early December to give you time to
prepare your class.

PyCon will compensate instructors US$1,500 per tutorial.

If you have any questions, please contact [EMAIL PROTECTED]


Greg Lindstrom
Tutorial Coordinator, PyCon 2009
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2009 (US) - Call for Tutorials

2008-10-01 Thread Greg Lindstrom
The period for submitting tutorial proposals for Pycon 2009 (US) is open and
will continue through Friday, October 31th. This year features two
"pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday
March 26 in Chicago. This allows for more classes than ever.

Tutorials are 3-hours long on a specific topic of your choice. Last year we
featured classes on Learning Python, Web Development, Scientific Computing,
and many more. Class size varied from 10 to over 60 students. The extended
time spent in class allows teachers to cover a lot of material while
allowing for interaction with students.

The full Call for Tutorial Proposals, including submission details, an
example proposal as well as a template, is available at <
http://us.pycon.org/2009/tutorials/proposals/>.

Tutorial selections will be announced in early December to give you time to
prepare your class and PyCon will compensate instructors US$1,500 per
tutorial.

If you have any questions, please contact [EMAIL PROTECTED]

Greg Lindstrom
Tutorial Coordinator, PyCon 2009 (US)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2009 (US) - Call for Tutorials

2008-10-18 Thread Greg Lindstrom
The period for submitting tutorial proposals for Pycon 2009 (US) is open and
will continue through Friday, October 31th. This year features two
"pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday
March 26 in Chicago. This allows for more classes than ever.

Tutorials are 3-hours long on a specific topic of your choice. Last year we
featured classes on Learning Python, Web Development, Scientific Computing,
and many more. Class size varied from 10 to over 60 students. The extended
time spent in class allows teachers to cover a lot of material while
allowing for interaction with students.

The full Call for Tutorial Proposals, including submission details, an
example proposal as well as a template, is available at <http://us.pycon
.org/2009/tutorials/proposals/>.

Tutorial selections will be announced in early December to give you time to
prepare your class and PyCon will compensate instructors US$1,500 per
tutorial.

If you have any questions, please contact [EMAIL PROTECTED]

Greg Lindstrom
Tutorial Coordinator, PyCon 2009 (US)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PyCon 2009 - Call for tutorials nearing the end

2008-10-29 Thread Greg Lindstrom
The period for submitting tutorial proposals for Pycon 2009 (US) is open and
will continue through Friday, October 31th. This year features two
"pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday
March 26 in Chicago. This allows for more classes than ever.

Tutorials are 3-hours long on a specific topic of your choice. Last year we
featured classes on Learning Python, Web Development, Scientific Computing,
and many more (there was particular interest in "Intermediate" level
classes).  Class size varied from 10 to over 60 students. The extended time
spent in class allows teachers to cover a lot of material while
allowing forinteraction with students.

The full Call for Tutorial Proposals, including submission details, an
example proposal as well as a template, is available at <
http://us.pycon.org/2009/tutorials/proposals/>.

Tutorial selections will be announced in early December to give you time to
prepare your class and PyCon will compensate instructors US$1,500 per
tutorial.

If you have any questions, please contact [EMAIL PROTECTED]

Greg Lindstrom
Tutorial Coordinator, PyCon 2009 (US)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor