Python script prob - Google Sitemap Generator

Python script prob - Google Sitemap Generator

Posted by: mahalie
Posted on: 2005-06-03 18:20:00

I'm trying to setup and use Google's new sitemap generator. (It was just released yesterday - here's the 'help' page: https://www.google.com/webmasters/sitemaps/docs/en/sitemap-generator.html).

It is just a python script and that calls a config file. I don't seem to be getting the script to recognize the config file. The instructions from google are to enter this line (while I'm SSH'ed in):

$ python sitemap_gen.py --config=/path/config.xml

I have the .py file and the .xml file in my general directory, that is... home/username/ and I have entered both

$ python sitemap_gen.py --config=/home/username/config.xml

and

$ python sitemap_gen.py --config=config.xml

since both files are in the same directory, and the one I'm running the script from.

I'm a total n00b at running scripts and unix commands in general. Through a little trial and error though, it would seem the script is excecuting as other things I've tried don't return anything. Here's what I'm getting:

mahalie@narcissus:~$ python sitemap_gen.py --config=config.xml
sitemap_gen.py:543: SyntaxWarning: local name 'consumer' in 'ProduceURLs' shadows use of 'consumer' as global in nested scope 'PerFile'
def ProduceURLs(self, consumer):
sitemap_gen.py:543: SyntaxWarning: local name 'root_path' in 'ProduceURLs' shadows use of 'root_path' as global in nested scope 'PerFile'
def ProduceURLs(self, consumer):
sitemap_gen.py:543: SyntaxWarning: local name 'root_URL' in 'ProduceURLs' shadows use of 'root_URL' as global in nested scope 'PerFile'
def ProduceURLs(self, consumer):
Traceback (most recent call last):
File "sitemap_gen.py", line 203, in ?
class URL(object):
NameError: name 'object' is not defined

Just to offer up thorough info - I searched the Knowledge base and did CHMOD 755 the .py file, and the .xml file just for kicks. Since I've tried running the command without the --config parameter and recieved the same error, it doesn't seem to be a problem with the paramaters set forth in the config.xml file either.

Any help would be MOST appreciated. I'm trying to write a step-by-step tutorial for using the Google Sitemap Generator (obviously not because I'm qualified to) because I think a lot of people will want to use it. Thank You!

mail[at]mahalie[dot]com

Re: Python script prob - Google Sitemap Generator

Posted by: ozgreg
Posted on: 2005-06-04 16:51:00

Firstly I am not a Python script programmer (PHP programmer) however I seen a line in your output that to me gives up the clue of what is wrong..

"mahalie@narcissus:~$ python sitemap_gen.py --config=config.xml
sitemap_gen.py:543: SyntaxWarning: local name 'consumer' in 'ProduceURLs' shadows use of 'consumer' as global in nested scope 'PerFile'"

Dreamhost has php globals turned on, I am not sure if this effects python but to me the warning is a local variable has a global value..

____________________

WP/Gallery2 Integration Community -> http://wpg2.ozgreg.com/

Re: Python script prob - Google Sitemap Generator

Posted by: mahalie
Posted on: 2005-06-04 17:21:00

Thanks for the input...any clues on how to fix it, a resource I should investigate, a python tutorial or something? Thanks again.

mail[at]mahalie[dot]com

Re: Python script prob - Google Sitemap Generator

Posted by: ardco
Posted on: 2005-06-04 17:58:00

This Google Groups thread has similar (not identical) error, and blames older version of Python (2.1.3). Instructions say you need version 2.2. Coincidentally my server only has 2.1.3. How about yours? (python -V)

Good luck,

BobS

Tags: googlepython scriptxml filechmod 755unix commandsroot pathhttpsscoperunninggloballocal