[OT] dudas con python

Daniel Carrasco Marín danielmadrid19 en gmail.com
Lun Jun 16 18:43:18 UTC 2014


En Python sólo he hecho un script y estoy muy verde por lo que no creo que
te pueda ayudar mucho, pero si me he fijado en que el comando que ejecutas
"pydoc modules" da una salida con unos errores que sugieren que te está
mostrando los módulos del Python 2.7 en lugar de los del 3.0.

Mira a ver si van por ahí los tiros...

Un saludo!!


2014-06-16 20:35 GMT+02:00 Aradenatorix Veckhom Vacelaevus <
aradnix en gmail.com>:

> Hola:
>
> Estaba haciendo unos scripts el otro día con python3 y al querer usar el
> modulo turtle para un ejemplo tuve errores al ejecutarlo.
>
> Mi primer idea fue que no tenía instalado bien el modulo o algo por lo que
> no podía ejecutar correctamente el script en cuestión que es el siguiente:
>
> # centipede.py
>
> from turtle import *
>
> def centipede(length, step, life):
>     penup()
>     theta = 0
>     dtheta = 1
>     for i in range(life):
>         forward(step)
>         left(theta)
>         theta += dtheta
>         stamp()
>         if i > length:
>             clearstamps(1)
>         if theta > 10 or theta < -10:
>             dtheta = -dtheta
>         if ycor() > 350:
>             left(360)
>
> def main():
>     setworldcoordinates(-400, -400, 400, 400)
>     centipede(14, 10, 200)
>     exitonclick()
>
> main()
>
> Al ejecutar dicho script con python3 obtengo el siguiente error:
>
> aradnix en Melania-V5-131:~/Documentos/Python 3$ python3 centipede.py
> Traceback (most recent call last):
>   File "/usr/lib/python3.4/tkinter/__init__.py", line 39, in <module>
>     import _tkinter
> ImportError: No module named '_tkinter'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "centipede.py", line 3, in <module>
>     from turtle import *
>   File "/usr/lib/python3.4/turtle.py", line 107, in <module>
>     import tkinter as TK
>   File "/usr/lib/python3.4/tkinter/__init__.py", line 41, in <module>
>     raise ImportError(str(msg) + ', please install the python3-tk package')
> ImportError: No module named '_tkinter', please install the python3-tk
> package
> aradnix en Melania-V5-131:~/Documentos/Python 3$
>
> Entonces pensé en buscar los módulos instalados en mi sistema, que es
> 14.04 LTS, busqué como ver eso, encontré aquí:
> http://agregando.es/2009/11/python-como-saber-que-modulos-tengo-instalados/
> y al ejecutar en terminal pydoc modules como recomienda obtuve lo siguiente:
>
> aradnix en Melania-V5-131:~$ pydoc modules
>
> Please wait a moment while I gather a list of all available modules...
>
> /usr/lib/python2.7/dist-packages/relatorio/templates/__init__.py:43:
> UserWarning: Unable to load plugin 'chart', you will not be able to use it
>
> Original traceback:
> -------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/relatorio/templates/__init__.py",
> line 32, in <module>
>     __import__('relatorio.templates.%s' % name)
>   File "/usr/lib/python2.7/dist-packages/relatorio/templates/chart.py",
> line 28, in <module>
>     import yaml
> ImportError: No module named yaml
>
>
>   warnings.warn(tb_file.getvalue())
> /usr/lib/python2.7/pkgutil.py:110: DeprecationWarning: The wxPython
> compatibility package is no longer automatically generated or actively
> maintained.  Please switch to the wx package as soon as possible.
>   __import__(name)
> ANSI                argparse            ihooks              scanext
> BaseHTTPServer      array               imaplib             sched
> Bastion             ast                 imghdr              scipy
> BeautifulSoup       asynchat            imp                 scour
> BeautifulSoupTests  asyncore            importlib           screen
> CDROM               atexit              imputil             screenlets
> CGIHTTPServer       atk                 indicator_keyboard  select
> Canvas              audiodev            inspect             serial
> CommandNotFound     audioop             invest
> sessioninstaller
> ConfigParser        autoreload          io                  sets
> Cookie              axi                 itertools           sgmllib
> Crypto              base64              jinja2              sha
> DLFCN               bdb                 joblib              shelve
> Dialog              binascii            json                shlex
> DocXMLRPCServer     binhex              keyword             shutil
> FSM                 bisect              ldap                signal
> FileDialog          blueman             ldapurl             simplegeneric
> FixTk               bonobo              ldb                 simplejson
> GMenuSimpleEditor   bookletimposer      ldif                sip
> HTMLParser          bs4                 lib2to3             sipconfig
> IN                  bsddb               libturpial          sipconfig_nd
> IPython             bz2                 libxml2             site
> Image               cPickle             libxml2mod          sitecustomize
> ImageChops          cProfile            linecache           six
> ImageColor          cStringIO           linuxaudiodev       smbc
> ImageCrackCode      cairo               locale              smtpd
> ImageDraw           calendar            lockfile            smtplib
> ImageEnhance        ccm                 logging             sndhdr
> ImageFile           cgi                 lsb_release         socket
> ImageFileIO         cgitb               lxml
> softwarecenter_aptd_plugins
> ImageFilter         chardet             macpath             sortsmill
> ImageFont           chunk               macurl2path         spwd
> ImageGL             cmath               mailbox             sql
> ImageGrab           cmd                 mailcap             sqlite3
> ImageMath           code                markupbase          sre
> ImageOps            codecs              markupsafe          sre_compile
> ImagePalette        codeop              marshal             sre_constants
> ImagePath           collections         math                sre_parse
> ImageQt             colorsys            matplotlib          ssl
> ImageSequence       commands            md5                 stat
> ImageStat           compileall          mhlib               statsmodels
> ImageTk             compiler            mimetools           statvfs
> ImageWin            compizconfig        mimetypes           storemagic
> Levenshtein         contextlib          mimify              string
> MimeWriter          cookielib           mmap                stringold
> MySQLdb             copy                modulefinder        stringprep
> ORBit               copy_reg            mpl_toolkits        strop
> OpenSSL             crypt               multifile           struct
> PAM                 csv                 multiprocessing     subprocess
> PIL                 ctypes              mutex               suds
> PSDraw              cups                mx                  sunau
> PngImagePlugin      cupsext             neso                sunaudio
> PyQt4               cupshelpers         netrc               svg_regex
> Queue               curl                new                 svg_transform
> ScrolledText        curses              nis                 symbol
> SimpleDialog        cvxopt              nntplib             sympy
> SimpleHTTPServer    cythonmagic         nose                sympyprinting
> SimpleXMLRPCServer  datetime            ntdb                symtable
> SocketServer        dateutil            ntpath              sys
> StringIO            dbhash              nturl2path          sysconfig
> TYPES               dbm                 numbers             syslog
> Tix                 dbus                numexpr             tables
> Tkconstants         deb822              numpy               tabnanny
> Tkdnd               debconf             oauth               talloc
> Tkinter             debian              oauthlib            tarfile
> UbuntuSystemService debian_bundle       octavemagic         tdb
> UserDict            debtagshw           oneconf             telnetlib
> UserList            decimal             opcode              tempfile
> UserString          decorator           openpyxl            termios
> _LWPCookieJar       defer               operator            test
> _MozillaCookieJar   difflib             optparse            textwrap
> __builtin__         dircache            os                  this
> __future__          dirspec             os2emxpath          thread
> _abcoll             dis                 ossaudiodev         threading
> _ast                distutils           pandas              tidy
> _bisect             doctest             pango               time
> _blueman            dot_parser          pangocairo          timeit
> _bsddb              drv_libxml2         parallelmagic       tkColorChooser
> _codecs             dsextras            parser              tkCommonDialog
> _codecs_cn          dsml                patsy               tkFileDialog
> _codecs_hk          dumbdbm             pcardext            tkFont
> _codecs_iso2022     dummy_thread        pdb                 tkMessageBox
> _codecs_jp          dummy_threading     pdfimposer          tkSimpleDialog
> _codecs_kr          duplicity           pexpect             toaiff
> _codecs_tw          email               pickle              token
> _collections        encodings           pickletools         tokenize
> _csv                errno               pipes               tornado
> _ctypes             exceptions          piston_mini_client  trace
> _ctypes_test        fcntl               pkg_resources       traceback
> _curses             fdpexpect           pkgutil             tryton
> _curses_panel       feedparser          platform            trytond
> _dbus_bindings      filecmp             plistlib            ttk
> _dbus_glib_bindings fileinput           polib               tty
> _elementtree        fnmatch             popen2              turpial
> _functools          fontforge           poplib              turtle
> _hashlib            formatter           posix               twisted
> _heapq              fpectl              posixfile           types
> _hotshot            fpformat            posixpath           ubuntu_sso
> _io                 fractions           pprint              unicodedata
> _json               ftplib              profile             uniconvertor
> _ldap               functools           psMat               unittest
> _locale             future_builtins     pstats              urllib
> _lsprof             gc                  psycopg2            urllib2
> _md5                gconf               pty                 urllib3
> _multibytecodec     gdbm                pwd                 urlparse
> _multiprocessing    genericpath         pxssh               user
> _mysql              genshi              pyPdf               uu
> _mysql_exceptions   getopt              py_compile          uuid
> _osx_support        getpass             pyclbr              vatnumber
> _pyio               gettext             pycurl              vobject
> _random             gi                  pydoc               warnings
> _sha                gio                 pydoc_data          wave
> _sha256             glib                pydot               weakref
> _sha512             glob                pyexpat             webbrowser
> _smbc               gmenu               pygst               webkit
> _socket             gnome               pygtk               whichdb
> _sqlite3            gnomecanvas         pygtkcompat         winpdb
> _sre                gnomekeyring        pylab               wnck
> _ssl                gnomevfs            pynotify            wsgiref
> _strptime           gobject             pyparsing           wx
> _struct             gpgme               pytz                wxPython
> _symtable           grp                 pywebdav            wxversion
> _sysconfigdata      gst                 quopri              xapian
> _sysconfigdata_nd   gstoption           random              xdg
> _testcapi           gtk                 re                  xdiagnose
> _threading_local    gtkunixprint        readline            xdrlib
> _tkinter            gtweak              relatorio           xlrd
> _warnings           gzip                reportlab           xlwt
> _weakref            hashlib             repr                xml
> _weakrefset         heapq               requests            xmllib
> abc                 hmac                resource            xmlrpclib
> aifc                hotshot             rexec               xxsubtype
> antigravity         hpmudext            rfc822              yocto_css
> antlr               html5lib            rlcompleter         zeitgeist
> anydbm              htmlentitydefs      rmagic              zipfile
> apt                 htmllib             robotparser         zipimport
> apt_inst            httplib             rpdb2               zlib
> apt_pkg             httplib2            rsvg                zmq
> aptdaemon           ibus                runpy               zope
> aptsources          idlelib             samba
>
> Enter any module name to get more help.  Or, type "modules spam" to search
> for modules whose descriptions contain the word "spam".
>
> Donde aparece el modulo que usé: turtle, por lo que el error no parece ser
> la falta del módulo, pero parece ser que faltan otros ya que hay unas
> advertencias (warnings) que supongo no deben ignorarse pero no sé a que
> aludan o como se resuelvan ¿alguien sabe cómo?
>
> Saludos
>
> --
> ubuntu-es mailing list
> ubuntu-es en lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-es
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://lists.ubuntu.com/archives/ubuntu-es/attachments/20140616/bba284ea/attachment-0001.html>


More information about the ubuntu-es mailing list