<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Sun May 19, 2013 5:22 am by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Sun May 19, 2013 5:22 am</pubDate>
  <lastBuildDate>Sun May 19, 2013 5:22 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103722#103722</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=4'&gt;evilnick&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Jan 07, 2012 11:23 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      The underscore characters you are using (I think just for effect) are unicode. You either need to define a unicode encoding at the top of the file or change them for something else like '-'. All the quotes look wrong, as has been mentioned.&lt;br /&gt;
also the if __name__ = '__main__'  bit is the main executable code in the file, so it shouldn't be indented like that, you have it  as part of the main() function, but actually it is the bit that invokes the main() function:&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
from django.utils.encoding import smart_str, smart_unicode &lt;br /&gt;
import twitter &lt;br /&gt;
&lt;br /&gt;
CusKey = &amp;quot;XX&amp;quot; &lt;br /&gt;
CusSec = &amp;quot;XXX&amp;quot; &lt;br /&gt;
AccTokKey = &amp;quot;XXXX&amp;quot; &lt;br /&gt;
AccTokKeySec = &amp;quot;XXXXX&amp;quot; &lt;br /&gt;
&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token_key = AccTokKey, access_token_secret = AccTokKeySec&amp;#41; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;timeline = api.GetFriendsTimeline&amp;#40;&amp;#41; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;for status in timeline&amp;#58; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print status.user.name.encode&amp;#40;'ascii', 'ignore'&amp;#41;, '----', status.text.encode&amp;#40;'ascii', 'ignore'&amp;#41; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
if __name__ == '__main__'&amp;#58; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;main&amp;#40;&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103722#103722</comments>
                                        <author>evilnick</author>
                                        <pubDate>Sat Jan 07, 2012 11:23 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103722#103722</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103137#103137</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=58561'&gt;Bazza&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun Dec 04, 2011 2:24 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Not really studied the code except to say......&lt;br /&gt;
&lt;br /&gt;
Check all of your single quotes as they look wrong they should be&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;quot;characters&amp;quot; or 'characters'&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103137#103137</comments>
                                        <author>Bazza</author>
                                        <pubDate>Sun Dec 04, 2011 2:24 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103137#103137</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103112#103112</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Dec 03, 2011 7:18 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      OK, &lt;br /&gt;
&lt;br /&gt;
Since Twitter moved from RSS feeds to OAuth you need to authorize all applications in the twitter API against your twitter account. The keys and stuff are needed to tell twitter that this application (That it does not have any prior idea of. Applications like Gwibber etc have their own sets of keys built in. This allow twitter to revoke access to the client if it does bad stuff) is allowed against your account. To get them you need to open a twitter Dev account. &lt;br /&gt;
&lt;br /&gt;
The script will be put into conky by using the conky exec command every X seconds: &lt;br /&gt;
&lt;br /&gt;
 &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;$&amp;#123;scroll 82 3 $&amp;#123;execi 300 perl /home/steve/twitter.pl -f | cat | fold -w120&amp;#125;&amp;#125;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
Like that (That being a perl twitter script. &lt;br /&gt;
&lt;br /&gt;
The script I was trying to use was found on a blog. However when I tried to contact that author to get more help I heard nothing back. I've dropped that script for the perl script above that worked first time &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt; there are lots of ways of doing twitter in conky I wanted to try something different!</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103112#103112</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Dec 03, 2011 7:18 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103112#103112</guid>
                                      </item>
                                      <item>
                                        <title>square one</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103013#103013</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun Nov 27, 2011 12:40 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Please explain what you want to achive with this script.&lt;br /&gt;
why do you need all these keys and API functions. &lt;br /&gt;
Can the output of your twitter stream be fetched without authorisation.&lt;br /&gt;
please explain how the output of the python script will be directed into conky.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103013#103013</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sun Nov 27, 2011 12:40 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103013#103013</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103010#103010</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun Nov 27, 2011 10:52 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      OK The script I was using isn't using the same twitter library as the one that you have downloaded. I imagine that they call the same stuff but the older ones are looking for python2.4. I've installed the other python libraries for twitter but when running it from the command line it complains that it cannot find cmdline which is an add-in that it creates. Back to the drawinig board I think !</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103010#103010</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sun Nov 27, 2011 10:52 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103010#103010</guid>
                                      </item>
                                      <item>
                                        <title>ok now things start to break down</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103007#103007</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 11:27 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      The twitter python module used in the code must be a different module from the one I downloaded from pypi &lt;a href=&quot;http://pypi.python.org/pypi/twitter/1.7.2&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://pypi.python.org/pypi/twitter/1.7.2&lt;/a&gt;&lt;br /&gt;
from the python interactive shell&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;help(twitter)&lt;br /&gt;
gives some good examples of how to use it, it uses OAuth by the looks of it</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103007#103007</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sat Nov 26, 2011 11:27 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103007#103007</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=103000#103000</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 7:21 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Now we are getting somewhere &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt; Sorta.... &lt;br /&gt;
&lt;br /&gt;
The Error was not from DJango I was using the wrong format for the Twitter Python API &lt;br /&gt;
 &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token_key = AccTokKey, access_token_secret = AccTokKeySec&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; timeline = api.GetFriendsTimeline&amp;#40;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for status in timeline&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# print status.user.name.encode&amp;#40;'ascii', 'ignore'&amp;#41;, status.text.encode&amp;#40;'ascii', 'ignore'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print staus.user.name.encode&amp;#40;'ascii', 'ignore'&amp;#41;, status.text.encode&amp;#40;'ascii', 'ignore'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if __name__ == '__main__'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; main&amp;#40;&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
However the program doesn't output anything now (It should dump my twitter stream)</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=103000#103000</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Nov 26, 2011 7:21 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=103000#103000</guid>
                                      </item>
                                      <item>
                                        <title>my code</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102999#102999</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 7:00 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
from django.utils.encoding import smart_str, smart_unicode&lt;br /&gt;
import twitter&lt;br /&gt;
&lt;br /&gt;
CusKey = &amp;quot;XX&amp;quot;&lt;br /&gt;
CusSec = &amp;quot;XXX&amp;quot;&lt;br /&gt;
AccTokKey = &amp;quot;XXXX&amp;quot;&lt;br /&gt;
AccTokKeySec = &amp;quot;XXXXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token.key = AccTokKey, access_token.secret = AccTokKeySec&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; timeline = api.GetFriendsTimeline&amp;#40;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for status in timeline&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# print status.user.name.encode&amp;#40;'ascii', 'ignore'&amp;#41;, status.text.encode&amp;#40;'ascii', 'ignore'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print staus.user.name.encode&amp;#40;'ascii', 'ignore'&amp;#41;, status.text.encode&amp;#40;'ascii', 'ignore'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if __name__ == '__main__'&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; main&amp;#40;&amp;#41;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
i run this in bash with python2 ~/path/to/file&lt;br /&gt;
it errors with&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;File &amp;quot;test.py&amp;quot;, line 10&lt;br /&gt;
&amp;nbsp; &amp;nbsp; api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token.key = AccTokKey, access_token.secret = AccTokKeySec&amp;#41;&lt;br /&gt;
SyntaxError&amp;#58; keyword can't be an expression&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
probly because i dont have the django modules and stuff&lt;br /&gt;
also i had to make sure the weird backticks are replaced with proper ' style quotes</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102999#102999</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sat Nov 26, 2011 7:00 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102999#102999</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102998#102998</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 6:52 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Strange It doesn't run for me with or without the ------ Things With or without the encoding. option. &lt;br /&gt;
&lt;br /&gt;
Could you please post what worked for you? I can then fill in my details for the Twitter API and see if it works!</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102998#102998</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Nov 26, 2011 6:52 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102998#102998</guid>
                                      </item>
                                      <item>
                                        <title>weird string</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102997#102997</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 6:36 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      It seems to run ok with that weird '----------' string removed</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102997#102997</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sat Nov 26, 2011 6:36 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102997#102997</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102996#102996</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 6:30 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Running:&lt;br /&gt;
&lt;br /&gt;
Python 2.7.2+&lt;br /&gt;
&lt;br /&gt;
How do you mean edit out the keys?</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102996#102996</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Nov 26, 2011 6:30 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102996#102996</guid>
                                      </item>
                                      <item>
                                        <title>version</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102995#102995</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 6:27 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Check what version of python your running this under&lt;br /&gt;
might want to edit out those keys?&lt;br /&gt;
the syntax for print has altered between v2.7xx and 3.xx&lt;br /&gt;
Something like #! /usr/sbin/python2.7 in the 1st line or whatever the path to 2.7 is on your system should sort that out</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102995#102995</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sat Nov 26, 2011 6:27 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102995#102995</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102994#102994</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 6:10 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I've been googling the error and have amended the code: &lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
# coding&amp;#58; utf-8&lt;br /&gt;
from django.utils.encoding import smart_str, smart_unicode&lt;br /&gt;
import twitter&lt;br /&gt;
&lt;br /&gt;
CusKey = &amp;quot;QTKBmU6YTstD4j9rxWFnIw&amp;quot;&lt;br /&gt;
CusSec = &amp;quot;QD2nPs1khqFIuH2mCNX88cbvXiufEnai58VmrNTJU&amp;quot;&lt;br /&gt;
AccTokKey = &amp;quot;117377091-VczOSo6Uh3hOnCaQq3qY7r8zP9VTX7lWvCZC61nh&amp;quot;&lt;br /&gt;
AccTokKeySec = &amp;quot;dMeeDhk4Xfex13w0PFZMp0VlJWR4JXKuElfHSRxs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token_key = AccTokKey, access_token_secret = AccTokKeySec&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;timeline = api.GetFriendsTimeline&amp;#40;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for status in timeline&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;print status.user.name.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;, ‘————’, status.text.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if __name__ == ‘__main__’&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;main&amp;#40;&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
This allows the code to pass the non ASCII error but I now get a new error: &lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
&amp;nbsp; File &amp;quot;timeline.py&amp;quot;, line 14&lt;br /&gt;
&amp;nbsp; &amp;nbsp; print status.user.name.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;, ‘————’, status.text.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;br /&gt;
SyntaxError&amp;#58; invalid syntax&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
I'm kinda getting use to python</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102994#102994</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Nov 26, 2011 6:10 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102994#102994</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102993#102993</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66020'&gt;thameslink&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 5:38 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      '————'  &amp;lt;--- these are the problem on line 13 I reckon just strip them out and see how it runs</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102993#102993</comments>
                                        <author>thameslink</author>
                                        <pubDate>Sat Nov 26, 2011 5:38 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102993#102993</guid>
                                      </item>
                                      <item>
                                        <title>Re: Python Help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=102990#102990</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=587'&gt;TwIsT&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 26, 2011 5:20 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks for the response... I don't know python myself &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt; I got this example from a blog post it looks like the authors blog has also stripped the white space. &lt;br /&gt;
I have fixed the indents. However I now get a new error: &lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;nbsp;File &amp;quot;timeline.py&amp;quot;, line 13&lt;br /&gt;
SyntaxError&amp;#58; Non-ASCII character '\xe2' in file timeline.py on line 13, but no encoding declared; see http&amp;#58;//www.python.org/peps/pep-0263.html for details&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
The File now Looks like: &lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
from django.utils.encoding import smart_str, smart_unicode&lt;br /&gt;
import twitter&lt;br /&gt;
&lt;br /&gt;
CusKey = &amp;quot;XX&amp;quot;&lt;br /&gt;
CusSec = &amp;quot;XXX&amp;quot;&lt;br /&gt;
AccTokKey = &amp;quot;XXXX&amp;quot;&lt;br /&gt;
AccTokKeySec = &amp;quot;XXXXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;api = twitter.Api&amp;#40;consumer_key = CusKey, consumer_secret = CusSec, access_token.key = AccTokKey, access_token.secret = AccTokKeySec&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;timeline = api.GetFriendsTimeline&amp;#40;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for status in timeline&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;print status.user.name.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;, ‘————’, status.text.encode&amp;#40;‘ascii’, ‘ignore’&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if __name__ == ‘__main__’&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;main&amp;#40;&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
I keep stripping out my values for the twitter API because with them you could read my twitter stream!!</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=102990#102990</comments>
                                        <author>TwIsT</author>
                                        <pubDate>Sat Nov 26, 2011 5:20 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=102990#102990</guid>
                                      </item></channel></rss>