I have been playing around with the Google Data Python Library and in the process of installation, I encountered this:
$ python tests/gdata_test.py
Traceback (most recent call last):
File "tests/gdata_test.py", line 29, in
import gdata.test_config as conf
ImportError: No module named test_config
I managed to fix it after trying out the Appendix attached in the Getting Started with Google Data Python Library. So just follow the instructions there and it should be okay. I guess they shouldn’t have put it in as appendix since appendices are rarely read, imo.
Appendix: Modifying the PYTHONPATH
When you import a package or module in Python, the interpreter looks for the file in a series of locations including all of the directories listed in the PYTHONPATH environment variable. I often modify my PYTHONPATH to point to modules where I have copied the source code for a library I am using. This prevents the need to install a module each time it is modified because Python will load the module directly from directory which contains the modified source code.
I recommend the PYTHONPATH approach if you are making changes to the client library code, or if you do not have admin rights on your system. By editing the PYTHONPATH, you can put the required modules anywhere you like.
I modified my PYTHONPATH on a *nix and Mac OS X system by setting it in my .bashrc shell configuration file. If you are using the bash shell, you can set the variable by adding the following line to your ~/.bashrc file.
export PYTHONPATH=$PYTHONPATH:/home//svn/gdata-python-client/src You can then apply these changes to your current shell session by executing
source ~/.bashrc.For Windows XP, pull up the Environment Variables for your profile: Control Panel > System Properties > Advanced > Environment Variables. From there, you can either create or edit the PYTHONPATH variable and add the location of your local library copy.