Re: Python weather application

2007-08-31 Thread dc
On Aug 30, 5:41 pm, Zentrader <[EMAIL PROTECTED]> wrote:
> On Aug 30, 12:45 pm, seancron <[EMAIL PROTECTED]> wrote:
>
>
>
> > Does anybody have any suggestions for getting started on desigining a
> > desktop weather application in Python?
>
> > I've been looking for access to weather data and while I have found
> > several including the weather.com service I've decided to use the
> > Yahoo! Rss Weather feed since it doesn't have a license like the
> > weather.com service does. However one problem I have with it is that
> > it only accepts zip codes or locations ids.  So if a user was to enter
> > the name of the city instead of those two there would be an error. I
> > could make it so they could only enter in the location code or zip
> > code but I would really prefer to have it be automatically corrected.
> > Does anyone have ideas on how to go about this or have an other
> > suggestions?
>
> > Thanks,
> > Sean
>
> Use a dictionary to convert from the city chosen to the zip/location
> code to use at Yahoo.

You can purchase/subscribe a zip code database and then use that as a
reverse look-up for your user entering a city. try the postal service
website for the database info.

-- 
http://mail.python.org/mailman/listinfo/python-list


newbie: Need Help Moving Data from Kirbybase to Gadfly

2006-04-10 Thread dc
I am fairly new to python and SQL. I have been trying to move data from
Kirbybase table to a Gadfly table and cannot get it to work. Win XP
with python 2.4, Kirbase 1.9, Gadfly B5.

Complete script shown here, with python traceback.

#   get global modules for python
import os
import sys

#get database manager module
from kirbybase import KirbyBase, KBError

# open a database, embedded
db = KirbyBase()
result=db.select('test2.tbl', ['recno'],['*'], returnType='object')

# open Gadfly database for storing data
import gadfly
connection = gadfly.gadfly()
connection.startup("subscription", "pvfd_sql")
cursor = connection.cursor()

# Insert all records into SQL Database
for record in result:
   sql="INSERT INTO addresslist (lastname, firstname, address, city,
state, zip_code, phone) VALUES(?, ?, ?, ?, ?, ?, ?)"
   cursor.execute(sql,result)
   connection.commit()
connection.close

#--
#  End of Script
#--



Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.

   
   Personal firewall software may warn about the connection IDLE
   makes to its subprocess using this computer's internal loopback
   interface.  This connection is not visible on any external
   interface and no data is sent to or received from the Internet.
   
   IDLE 1.1.2   No Subprocess 
>>>
Traceback (most recent call last):
 File "C:\Documents and Settings\timothy volner\Desktop\puryear\move
records to sql.py", line 30, in ?
   cursor.execute(sql,result)
 File "C:\Python24\lib\site-packages\gadfly\database.py", line 367, in
execute
   cs[i] = cs[i].relbind(database)
 File "C:\Python24\lib\site-packages\gadfly\operations.py", line 601,
in relbind
   target = self.target = db.get_for_update(name)
 File "C:\Python24\lib\site-packages\gadfly\store.py", line 201, in
get_for_update
   test = rels[name]
 File "C:\Python24\lib\site-packages\gadfly\store.py", line 1043, in
__getitem__
   return self.shadow[key]
KeyError: 'ADDRESSLIST'
>>>

No matter what I do to data, I always end up with this error.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: Need Help Moving Data from Kirbybase to Gadfly

2006-04-10 Thread dc
I have muddle through this and gotten my script to work. Corrected code
attached.

#   get global modules for python
import os
import sys

#get database manager module
from kirbybase import KirbyBase, KBError

# open a database, embedded
db = KirbyBase()
result=db.select('test2.tbl', ['recno'],['*'], returnType='object')

# open Gadfly database for storing data
import gadfly
connection = gadfly.gadfly("subscription", "pvfd_sql")

#connection.startup("subscription", "pvfd_sql")
cursor = connection.cursor()

# Insert all records into SQL Database
for record in result:
   ln=str(record.lastname).strip("'")
   fn=str(record.firstname).strip("'")
   ci=str(record.city).strip("'")
   st=str(record.state).strip("'")
   ad=str(record.address).strip("'")
   zi=str(record.zip).strip("'")
   ph=str(record.phone).strip("'")

   sql = "INSERT INTO addresslist (lastname, firstname,CITY, STATE,
ADDRESS, ZIPCODE, PHONE) VALUES(?,?,?,?,?,?,?)"
   cursor.execute(sql,(ln, fn, ci, st, ad, zi, ph))
   print "adding..."
   connection.commit()
connection.close

#--
#  End of Script
#--

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: Need Help Moving Data from Kirbybase to Gadfly

2006-04-11 Thread dc
The addresslist table was defined and did exist, I had connection
defined incorrectly.

-- 
http://mail.python.org/mailman/listinfo/python-list