urlopen errors in script

Sleepy Cabbage sleepy at cabbage.co.uk
Tue Aug 18 12:05:18 CEST 2009


I'm scripting a superkaramba theme using python and have intgrated output
from amarok. I have also would like to show the artist and song title from
a radio stream i've added to my playlist.

If I open a python console and add the following:

>>>import urllib2
>>>from urllib2 import urlopen

>>>nowplaying = str.split(urlopen('http://www.hearteastmids.co.uk//
jsfiles/NowPlayingDisplay.aspx?f=http%3A%2F%2Frope.ccap.fimc.net%2Ffeeds%
2Fnowplaying%2FGlobal%2FHeart_Network%2FHeart_East_Midlands%
2F6854.xml&l=6854&tzc=8&at=HeartEastMids').read(),'>')

>>>print test[4][:-3]

this works and displays the artist and song title.

However, when I add this to my script I get the following errors:

----------------------------------------------------------------------------

superkaramba(28855) ThemesDlg::addThemeToList: addThemeToList() file:  "/
home/sleepy/dev/MyTheme/
MyTheme.theme"
superkaramba(28855) Karamba::startKaramba: Loading script module:
"MyTheme.py"
superkaramba(28855) KarambaInterface::initInterpreter: Using  "python"
script:  "/home/sleepy/dev/MyTheme/
MyTheme.py"
Kross: "Loading the interpreter library for python"
Kross: "Successfully loaded Interpreter instance from library."
Kross:
"PythonScript::Constructor."
Kross:
"PythonScript::execute"
Kross:
"PythonInterpreter::extractException:
  File "/home/sleepy/dev/MyTheme/MyTheme.py", line 4, in
<module>
    #this import statement allows access to the karamba
functions

  File "/home/sleepy/dev/MyTheme/MyTheme.py", line 9, in <module>
    import urllib2

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/urllib2.py", line 92, in <module>
    import httplib

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/httplib.py", line 1054, in <module>
    import ssl

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/ssl.py", line 81, in <module>
    class SSLSocket (socket):
"
Kross: "Error error=Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given) lineno=81 trace=
  File "/home/sleepy/dev/MyTheme/MyTheme.py", line 4, in
<module>
    #this import statement allows access to the karamba functions

  File "/home/sleepy/dev/MyTheme/MyTheme.py", line 9, in <module>
    import urllib2

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/urllib2.py", line 92, in <module>
    import httplib

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/httplib.py", line 1054, in <module>
    import ssl

  File "<string>", line 18, in _import

  File "/usr/lib/python2.6/ssl.py", line 81, in <module>
    class SSLSocket (socket):
"
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 38,
in apport_excepthook
    from apport.packaging_impl import impl as
packaging
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apport/__init__.py", line 1, in
<module>
    from apport.report import
Report
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apport/report.py", line 21, in
<module>
    import
fileutils
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apport/fileutils.py", line 16,
in <module>
    from packaging_impl import impl as
packaging
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apport/packaging_impl.py", line
18, in <module>
    import
apt
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apt/__init__.py", line 7, in
<module>
    from apt.package import
Package
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/dist-packages/apt/package.py", line 23, in
<module>
    import
httplib
  File "<string>", line 18, in
_import
  File "/usr/lib/python2.6/httplib.py", line 1054, in
<module>
    import
ssl
  File "<string>", line 18, in _import
  File "/usr/lib/python2.6/ssl.py", line 81, in <module>
    class SSLSocket (socket):
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)

Original exception was:
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)
Kross: "PythonScript::Destructor."

------------------------------------------------------------------------

Thanks in advance




More information about the Python-list mailing list