0

This question is actually threefold. I have questions mostly regarding Python and the installation process. I also have questions on how I can find documentation for a module that is hosted on GitHub.

I am currently running Ubuntu 14.04. Does this version of Ubuntu come with Python 2.x or 3.x already installed? I forgot to check this before moving forward with my own install of Python 2.7. I performed the install by downloading the tarball (is that what people call it?) from the Python website, unzipping it, and then running the make commands. Now I'm worried that I may have 2 installations of Python installed on my PC, but in two different directories. I'm not overly familiar with Ubuntu, so I don't know how to check if I unnecessarily installed Python when it was really there when I initially put Ubuntu onto my PC. Is this something I should be concerned about? And if so, what's the best way for me to get rid of the second installation?

My second question involves the python-twitter module. I installed this via sudo apt-get install python-twitter. I'm not sure if that was a valid approach, but I did see it come up on other posts on this forum. I am trying to do the Arduino Tweet-a-Pot and would like to understand the Python code that it uses. When I look at the python-twitter page on GitHub, it appears that I can find documentation using the PyDoc command. However, if I run the commands they recommend, I see the following output on my terminal:

mike@BIGRED:~$ pydoc twitter.api
no Python documentation found for 'twitter.api'

However, if I run pydoc modules, I receive the following output:

mike@BIGRED:~$ pydoc modules

Please wait a moment while I gather a list of all available modules...

BaseHTTPServer      array               ihooks              sgmllib
Bastion             ast                 imaplib             sha
CDROM               asynchat            imghdr              shelve
CGIHTTPServer       asyncore            imp                 shlex
Canvas              atexit              importlib           shutil
ConfigParser        audiodev            imputil             signal
Cookie              audioop             inspect             site
DLFCN               base64              io                  smtpd
Dialog              bdb                 itertools           smtplib
DocXMLRPCServer     binascii            json                sndhdr
FileDialog          binhex              keyword             socket
FixTk               bisect              lib2to3             spwd
HTMLParser          bsddb               linecache           sqlite3
IN                  bz2                 linuxaudiodev       sre
MimeWriter          cPickle             locale              sre_compile
Queue               cProfile            logging             sre_constants
ScrolledText        cStringIO           macpath             sre_parse
SimpleDialog        calendar            macurl2path         ssl
SimpleHTTPServer    cgi                 mailbox             stat
SimpleXMLRPCServer  cgitb               mailcap             statvfs
SocketServer        chunk               markupbase          string
StringIO            cmath               marshal             stringold
TYPES               cmd                 math                stringprep
Tix                 code                md5                 strop
Tkconstants         codecs              mhlib               struct
Tkdnd               codeop              mimetools           subprocess
Tkinter             collections         mimetypes           sunau
UserDict            colorsys            mimify              sunaudio
UserList            commands            mmap                symbol
UserString          compileall          modulefinder        symtable
_LWPCookieJar       compiler            multifile           sys
_MozillaCookieJar   contextlib          multiprocessing     sysconfig
__builtin__         cookielib           mutex               syslog
__future__          copy                netrc               tabnanny
_abcoll             copy_reg            new                 tarfile
_ast                crypt               nis                 telnetlib
_bisect             csv                 nntplib             tempfile
_codecs             ctypes              ntpath              termios
_codecs_cn          curses              nturl2path          test
_codecs_hk          datetime            numbers             textwrap
_codecs_iso2022     dbhash              opcode              this
_codecs_jp          dbm                 operator            thread
_codecs_kr          decimal             optparse            threading
_codecs_tw          difflib             os                  time
_collections        dircache            os2emxpath          timeit
_csv                dis                 ossaudiodev         tkColorChooser
_ctypes             distutils           parser              tkCommonDialog
_ctypes_test        doctest             pdb                 tkFileDialog
_curses             dumbdbm             pickle              tkFont
_curses_panel       dummy_thread        pickletools         tkMessageBox
_elementtree        dummy_threading     pipes               tkSimpleDialog
_functools          email               pkgutil             toaiff
_hashlib            encodings           platform            token
_heapq              ensurepip           plistlib            tokenize
_hotshot            errno               popen2              trace
_io                 exceptions          poplib              traceback
_json               fcntl               posix               ttk
_locale             filecmp             posixfile           tty
_lsprof             fileinput           posixpath           turtle
_multibytecodec     fnmatch             pprint              types
_multiprocessing    formatter           profile             unicodedata
_osx_support        fpformat            pstats              unittest
_pyio               fractions           pty                 urllib
_random             ftplib              pwd                 urllib2
_socket             functools           py_compile          urlparse
_sqlite3            future_builtins     pyclbr              user
_sre                gc                  pydoc               uu
_ssl                gdbm                pydoc_data          uuid
_strptime           genericpath         pyexpat             warnings
_struct             getopt              quopri              wave
_symtable           getpass             random              weakref
_sysconfigdata      gettext             re                  webbrowser
_testcapi           glob                readline            whichdb
_threading_local    grp                 repr                wsgiref
_tkinter            gzip                resource            xdrlib
_warnings           hashlib             rexec               xml
_weakref            heapq               rfc822              xmllib
_weakrefset         hmac                rlcompleter         xmlrpclib
abc                 hotshot             robotparser         xxsubtype
aifc                htmlentitydefs      runpy               zipfile
antigravity         htmllib             sched               zipimport
anydbm              httplib             select              zlib
argparse            idlelib             sets      

As you can see, PyDoc works, it just doesn't seem to work for the Twitter module. And I know that the python-twitter was indeed installed correctly because the code works with my Arduino. How can I correct this? I'd like to have the PyDoc functionality work correctly for this and any future modules I plan to install.

I should mention that I am try to teach myself programming and only have a fair amount of exposure of Python. I definitely still have much to learn. My last question is a simple one: How do I find documentation for the python-twitter module on GitHub? PyDoc doesn't seem to work, but I believe there should still be something on GitHub that would include the same information: what classes there are, the different methods available for each class, etc. Is it somewhere in the source code? Where on the GitHub page do I find this sort of information?

Any clarification on any of this would be greatly appreciated!

0

Ubuntu has been shipping with Python for quite a while. I'm quite certain that it probably came with your distro. The easiest way to check is to just go into the software center and search for Python. It will come up, and if there is a green check mark that means it is already installed.

As for the python-twitter docs, I would be inclined to look for more info on twitter's developer pages. Pretty much every api out there is listed and each has it's own info page. IIRC the python-twitter api even has it's own google group. So maybe search google groups for python-twitter as well.

As for the pydoc issue, my understanding is that the stock pydoc library is for the core modules that ship with python.

| improve this answer | |
  • Thanks for the reply! I actually looked on the Twitter page for documentation and it takes me to the GitHub page. The GitHub page points me back to the Twitter documentation website, so it seems like an endless circle. . . Any additional help would be appreciated! – coolDude Jul 9 '15 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.