Philadelphia Python Workshop/Setup/Linux project dependencies: Difference between revisions

imported>Abatula
imported>Abatula
Line 65:
</pre>
 
will show you the source code files in that directory. In this directory are five folders: Twitter (the main folder) and four dependency folders (simplejson-3.3.0, python-oauth2-master, httplib2-0.8, and python-twitter-1.0). EachThree of these 4the dependency subfolders hashave an installer script that we'll need to run at a command prompt to install the software. For each dependency (in the order: simplejson-3.3.0 python-oauth2-master httplib2-0.8 python-twitter-1.0) navigate to the folder using cd. For example:
<pre>
cd simplejson-3.3.0
Line 84:
 
 
Navigate to the 32 other dependency directories and run
 
<pre>
Line 104:
</pre>
 
Now use cd to move into the python-twitter-1.0 folder. This time we will run the two following commands to install the dependency:
===Download the Twitter project===
<pre>
python setup.py build
python setup.py install
</pre>
 
If you get a permissions error, use the sudo command for authorization:
We've written some skeleton code for the Twitter project already. Download this code so you're ready to start working with it tomorrow:
<pre>
sudo python setup.py build
sudo python setup.py install
<pre>
 
And type in your password when prompted.
# Right click the following file, click "Save Target as..." or "Save link as...", and save it to your Desktop directory:
#* http://web.mit.edu/jesstess/www/BostonPythonWorkshop6/Twitter.tar.gz
#Find Twitter.tar.gz on your Desktop and double-click on it to "extract" it. That will create a folder called Twitter containing several files.
 
===Test the Twitter code===
 
Within the python-twitter-1.0 folder, run
Start a command prompt and navigate to the Desktop/Twitter directory where the Twitter code lives. For example, if the Twitter project is at <code>/home/jesstess/Desktop/Twitter</code>,
 
<pre>
python twitter_test.py
cd /home/jesstess/Desktop/Twitter
</pre>
 
After it runs, it should state that it ran 41 tests on the code, and the final line should say "OK." If your test failed, ask an instructor for help.
will change you into that directory, and
 
<pre>
ls
</pre>
 
willAfter showsuccessfully youtesting the sourcedependencies, codeuse the cd command again to navigate to the Twitter folder. Use the ls command again to view the files in thatthis directoryfolder. One of the files is "twitter_api.py", which has a ".py" extension indicating that it is a Python script. Type:
 
<pre>
Anonymous user