Python script prob - Google Sitemap Generator

apps

#1

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.xmlI 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.xmland

$ python sitemap_gen.py --config=config.xmlsince 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 definedJust 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


#2

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/


#3

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