Re: CGI and external JavaScript nightmare

2007-10-18 Thread IamIan
> > The OP's problem is that he suffers from the delusion that people want > > to steal the source code for hisCGIscript. Why is assuming someone may try to get my source CGI delusional? I'm on a shared server (Dreamhost). The CGI itself has 755 permissions to execute, but what about folder permi

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: CGI and external JavaScript nightmare

2007-10-17 Thread IamIan
Thank you for the replies. After a lot of research I tracked down the issue. I was using the CGI to build all of the pages for the site, then filling in content with .innerHTML= as users clicked on tabs. Since I wanted to place the Google Ads in different parts of each page, the Google Ads JavaScri

Re: CGI and external JavaScript nightmare

2007-10-11 Thread IamIan
bump -- http://mail.python.org/mailman/listinfo/python-list

CGI and external JavaScript nightmare

2007-10-10 Thread IamIan
My website is built from a Python CGI and works great. I'm now including Google Ads, which requires two pieces of JavaScript; the first contains the display settings for the ads, and the second piece is a very lengthy garbled js file at http://pagead2.googlesyndication.com/pagead/show_ads.js The

Re: Simple elementtree question

2007-08-30 Thread IamIan
Thank you very much! That did it. In the source XML tags have rdf:about attributes with the link to the story, and it was here I planned on grabbing the link and matching it up with the child text. After seeing the output of elmenttree's getiterator() though, it now looks like each item, title,

Simple elementtree question

2007-08-30 Thread IamIan
This is in Python 2.3.5. I've had success with elementtree and other RSS feeds, but I can't get it to work with this format: http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:fr="http://ASPRSS.com/fr.html"; xmlns:pa="http://ASPRSS.com/pa.html"; xm

XML / Unicode / SAX question

2007-07-03 Thread IamIan
I am using SAX to parse XML that has numeric html entities I need to convert and feed to JavaScript as part of a CGI. I can get the characters to print correctly, but not without being surrounded by linebreaks: from xml.sax import make_parser from xml.sax.handler import ContentHandler import htmle

Re: Splitting SAX results

2007-06-12 Thread IamIan
I do know how split works, but thank you for the response. The end result that I want is a dictionary made up of the title results coming through SAX, looking like {'Title1: Description', 'Title2:Description'}. The XML data looks like: Title1:Description Link Desc Author Date Title2:Description

Re: Splitting SAX results

2007-06-08 Thread IamIan
Well SAX isn't the problem... maybe I should repost this with a different title. The SAX part works just as I want, but the results I get back need to be manipulated. No matter what I try I can't split a result like 'Title 1:Description' on the colon without getting an IndexError. Ideas anyone? --

Splitting SAX results

2007-06-06 Thread IamIan
Hi list, I have a very simple SAX script from which I get results like 'Title1:Description','Title2:Description'. I want to split each result on the colon, using the two resulting elements as key/value pairs in a dictionary. I've tried a couple different approaches with lists etc, but I keep getti

Re: Nested dictionaries trouble

2007-04-19 Thread IamIan
Thank you again for the great suggestions. I have one final question about creating a httpMonths dictionary like {'Jan':'01' , 'Feb':'02' , etc} with a minimal amount of typing. My code follows (using Python 2.3.4): import calendar # Create years list, formatting as strings years = map(str, xrang

Re: Nested dictionaries trouble

2007-04-18 Thread IamIan
I am using the suggested approach to make a years list: years = ["199%s" % x for x in range(0,10)] years += ["200%s" % x for x in range(0,10)] I haven't had any luck doing this in one line though. Is it possible? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested dictionaries trouble

2007-04-11 Thread IamIan
Thank you everyone for the helpful replies. Some of the solutions were new to me, but the script now runs successfully. I'm still learning to ride the snake but I love this language! Ian -- http://mail.python.org/mailman/listinfo/python-list

Nested dictionaries trouble

2007-04-11 Thread IamIan
Hello, I'm writing a simple FTP log parser that sums file sizes as it runs. I have a yearTotals dictionary with year keys and the monthTotals dictionary as its values. The monthTotals dictionary has month keys and file size values. The script works except the results are written for all years, rat

Re: 08 and 09 in sequence create "invalid token" error?!

2007-04-06 Thread IamIan
Thank you! Ian -- http://mail.python.org/mailman/listinfo/python-list

08 and 09 in sequence create "invalid token" error?!

2007-04-06 Thread IamIan
Hello all, I am confused as to why including 08 or 09 in a sequence (list or tuple) causes this error. All other numbers with a leading zero work. [01,02,03,04,05,06,07] is fine [01,02,03,04,05,06,07,10] is fine [01,02,03,04,05,06,08] produces "SyntaxError: invalid token", as does: [01,02,03,

Re: Regexp not performing the same in FTP versus Python

2007-02-08 Thread IamIan
It's strange but since more files have been added to this directory the regexp appears to be working correctly. Sorry to bother the list and thanks for your time. Ian -- http://mail.python.org/mailman/listinfo/python-list

Regexp not performing the same in FTP versus Python

2007-02-08 Thread IamIan
Hello all, I'm trying to use a regular expression in an FTP script to list certain files. When run in a standard FTP session the command: dir .??[oOdDnNmM]* returns 48 files. When I use the following Python script it prints roughly 12 files (a subset of the 48), ending with 'None': imp

Re: Exiting os.spawnv's subroutine

2006-02-22 Thread IamIan
Strange but removing the try/except part of the second script (leaving only the processing) removed the 2 minute lag at the end of each subroutine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Exiting os.spawnv's subroutine

2006-02-21 Thread IamIan
My code is below. As a single script there is no pause at the end of the processing as there is with using os.spawnv... I am using the P_WAIT value, and wonder if it is responsible for the extra time at the end of each iteration. Could it take longer for the processing to be "successful" when run u

Exiting os.spawnv's subroutine

2006-02-17 Thread IamIan
I am using os.spawnv in Python 2.1 to do some geoprocessing in a subroutine/process. Everything works great, except when the processing is done the subroutine just waits for a couple minutes before closing itself and returning to the main script. I have tried using sys.exit() and exit() but these a

Help with os.spawnv

2006-02-09 Thread IamIan
I've had to migrate back to Python 2.1 and am now trying to use os.spawnv to get around a memory leak (either in Python or ArcGIS or both) in a geoprocessing script. This script (Second Script) gets each Ascii file in the workspace, converts it to a raster, sets the spatial reference, and hillshad

Re: Pulling numbers from ASCII filename not working

2006-02-01 Thread IamIan
Thanks for the help everyone (especially those that gave more answers than attitude). It's working perfectly! Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Pulling numbers from ASCII filename not working

2006-01-25 Thread IamIan
>Dude. You're trying to add a string to an int. What did you think would >happen? Dude. I thought it would concatenate the value for LatInt with the rest of the sentence; I wasn't literally trying to add them. Apparently you can only concatenate strings like this in Python. -- http://mail.python

Re: Pulling numbers from ASCII filename not working

2006-01-25 Thread IamIan
Thank you for the replies, I'm new to Python and appreciate your patience. I'm using Python 2.1. To reiterate, the ASCII files in the workspace are being read correctly and their latitude values (coming from the filenames) are successfully being converted to string. Even doing LatInt = int(LatStri

Re: Pulling numbers from ASCII filename not working

2006-01-24 Thread IamIan
The exception I get is "TypeError: Cannot add value 'int' to string." I have looked at LatString, and it is the string representation of latitude ('17' etc.). What's odd is that the exception is raised not when I include LatInt = int(LatString), but when I try to print LatInt's value or multiply it

Pulling numbers from ASCII filename not working

2006-01-24 Thread IamIan
I searched the archives but couldn't find anyone else with this problem. Basically I'm grabbing all ASCII files in a directory and doing geoprocessing on them. I need to calculate a z-factor based on the latitude of the ASCII file being worked on, which is in the filename. If I type in the code man