LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-20-2011, 05:00 AM   #1
lee_can
Member
 
Registered: Mar 2011
Posts: 118

Rep: Reputation: 1
ImportError: No module named google


Dear all,

I was learning how to interact with Google search programatically by using API which was developed by Google.
I start with googly.py.
after entering the google.LICENSE_KEY here in below, and start runing it, i got error, so when i look into the folder containing the script, i found 2 files, codecs and google and by mistake i use rm to remove them.
so now, when i fix the error and try to run the script, i get error:
Traceback (most recent call last):
File "./googly.py", line 11, in <module>
import google
ImportError: No module named google

Anyone can advise how i restore them back?

Thanks in advance guys
-------------------------------------------------
#!/usr/bin/python
# googly.py
# A typical Google Web API Python script using Mark Pilgrim's
# PyGoogle Google Web API wrapper
# [http://diveintomark.org/projects/pygoogle/].
# Usage: python googly.py <query>

import sys, string, codecs

# Use the PyGoogle module.
import google

# Grab the query from the command line
if sys.argv[1:]:
query = sys.argv[1]
else:
sys.exit('Usage: python googly.py <query>')

# Your Google API developer's key.
google.LICENSE_KEY = ' my license key'

# Query Google.
data = google.doGoogleSearch(query)

# Teach standard output to deal with utf-8 encoding in the results.
sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)

# Output.
for result in data.results:
print string.join( (result.title, result.URL, result.snippet), "\n"), "\n"

Last edited by lee_can; 03-21-2011 at 01:36 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-20-2011, 05:45 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Did you reinstall the needed files?

And for the record, you should edit your post and remove your license key....

Cheers,

Josh
 
Old 03-21-2011, 01:38 PM   #3
lee_can
Member
 
Registered: Mar 2011
Posts: 118

Original Poster
Rep: Reputation: 1
Thank you very much corp769 for your reply and for your advise, really appreciate.

But how can i re-install the needed files "codecs and google" ?
 
Old 03-21-2011, 02:08 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
The module you are trying to use is not supported anymore anyway. Take a look at these links:

http://pygoogle.sourceforge.net/
http://dcortesi.com/2008/05/28/googl...e-python-code/

Cheers,

Josh
 
2 members found this post helpful.
Old 03-23-2011, 02:28 PM   #5
lee_can
Member
 
Registered: Mar 2011
Posts: 118

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by corp769 View Post
The module you are trying to use is not supported anymore anyway. Take a look at these links:

http://pygoogle.sourceforge.net/
http://dcortesi.com/2008/05/28/googl...e-python-code/

Cheers,

Josh
Thanks Josh for these information, really appreciate.

Regards
 
Old 03-23-2011, 02:51 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
No problem at all man!

Cheers,

Josh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ImportError: No module named pygtk orbit Slackware 11 06-25-2013 07:50 AM
ImportError: No module named cairo mattjohnstone22 Linux - Software 1 11-14-2007 06:12 AM
ImportError: No module named SimulationServer nageshbgl Linux - Newbie 1 09-26-2007 04:59 AM
ImportError: No module named libglade Kanaflloric Programming 0 08-16-2004 10:58 PM
ImportError: No module named gconf linorg Linux - Software 8 02-02-2004 05:37 PM


All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration