Seite 1 von 1

Cookielib will unter Linux nicht cooken

Verfasst: Montag 2. März 2009, 02:22
von Bong-Jour
Der Login will unter Linux einfach nicht funktionieren. Da die Parameter alle koreckt sind und es unter Windows prima läuft, denke ich, es liegt am Cookie. Hat jemand ne Idee... ?

Code: Alles auswählen

Cookie = cookielib.CookieJar()
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor(Cookie)))

def Anfrage(Url, Parameter):

    Parameter = urllib.urlencode(Parameter)
        return urllib2.urlopen(urllib2.Request(Url, Parameter, Header)).read()

Verfasst: Montag 2. März 2009, 10:25
von Leonidas
Willst du vielleicht eigentlich ``mechanize`` nutzen? Schau es dir mal an, das könnte genau das sein was du suchst.

Verfasst: Montag 2. März 2009, 12:33
von Bong-Jour
Um ehrlich zu sein, würde ich das auch gerne. Aber "es" stellt sich beim Installieren extrem dämlich an.. (Der letzte Satze ist, denke ich, der entscheidende. Nich, dass das jemand alles liest ^^ Auch mit easy_install will nicht. Ich benutze Active Python 2.5)



C:\Dokumente und Einstellungen\Bill Gates\Desktop\mechanize-0.1.10>setup.py install

running install
running bdist_egg
running egg_info
writing requirements to mechanize.egg-info\requires.txt
writing mechanize.egg-info\PKG-INFO
writing top-level names to mechanize.egg-info\top_level.txt
writing dependency_links to mechanize.egg-info\dependency_links.txt
reading manifest file 'mechanize.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs-in-progress'
writing manifest file 'mechanize.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_testcase.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_html.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_auth.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_http.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_response.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_firefox3cookiejar.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_headersutil.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_pullparser.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_lwpcookiejar.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_useragent.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_seek.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_upgrade.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_sockettimeout.py -> build\bdist.win32\egg\mechanize

copying build\lib\mechanize\_msiecookiejar.py -> build\bdist.win32\egg\mechanize

copying build\lib\mechanize\_beautifulsoup.py -> build\bdist.win32\egg\mechanize

copying build\lib\mechanize\_opener.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_clientcookie.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_mozillacookiejar.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_file.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_mechanize.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_rfc3986.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_urllib2.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\__init__.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_debug.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_util.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_request.py -> build\bdist.win32\egg\mechanize
copying build\lib\mechanize\_gzip.py -> build\bdist.win32\egg\mechanize
byte-compiling build\bdist.win32\egg\mechanize\_testcase.py to _testcase.pyc
byte-compiling build\bdist.win32\egg\mechanize\_html.py to _html.pyc
byte-compiling build\bdist.win32\egg\mechanize\_auth.py to _auth.pyc
byte-compiling build\bdist.win32\egg\mechanize\_http.py to _http.pyc
byte-compiling build\bdist.win32\egg\mechanize\_response.py to _response.pyc
byte-compiling build\bdist.win32\egg\mechanize\_firefox3cookiejar.py to _firefox3cookiejar.pyc
byte-compiling build\bdist.win32\egg\mechanize\_headersutil.py to _headersutil.pyc
byte-compiling build\bdist.win32\egg\mechanize\_pullparser.py to _pullparser.pyc
byte-compiling build\bdist.win32\egg\mechanize\_lwpcookiejar.py to _lwpcookiejar.pyc
byte-compiling build\bdist.win32\egg\mechanize\_useragent.py to _useragent.pyc
byte-compiling build\bdist.win32\egg\mechanize\_seek.py to _seek.pyc
byte-compiling build\bdist.win32\egg\mechanize\_upgrade.py to _upgrade.pyc
byte-compiling build\bdist.win32\egg\mechanize\_sockettimeout.py to _sockettimeout.pyc
byte-compiling build\bdist.win32\egg\mechanize\_msiecookiejar.py to _msiecookiejar.pyc
byte-compiling build\bdist.win32\egg\mechanize\_beautifulsoup.py to _beautifulsoup.pyc
byte-compiling build\bdist.win32\egg\mechanize\_opener.py to _opener.pyc
byte-compiling build\bdist.win32\egg\mechanize\_clientcookie.py to _clientcookie.pyc
byte-compiling build\bdist.win32\egg\mechanize\_mozillacookiejar.py to _mozillacookiejar.pyc
byte-compiling build\bdist.win32\egg\mechanize\_file.py to _file.pyc
byte-compiling build\bdist.win32\egg\mechanize\_mechanize.py to _mechanize.pyc
byte-compiling build\bdist.win32\egg\mechanize\_rfc3986.py to _rfc3986.pyc
byte-compiling build\bdist.win32\egg\mechanize\_urllib2.py to _urllib2.pyc
byte-compiling build\bdist.win32\egg\mechanize\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\mechanize\_debug.py to _debug.pyc
byte-compiling build\bdist.win32\egg\mechanize\_util.py to _util.pyc
byte-compiling build\bdist.win32\egg\mechanize\_request.py to _request.pyc
byte-compiling build\bdist.win32\egg\mechanize\_gzip.py to _gzip.pyc
creating build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
copying mechanize.egg-info\zip-safe -> build\bdist.win32\egg\EGG-INFO
creating 'dist\mechanize-0.1.10-py2.5.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing mechanize-0.1.10-py2.5.egg
Removing c:\python25\lib\site-packages\mechanize-0.1.10-py2.5.egg
Copying mechanize-0.1.10-py2.5.egg to c:\python25\lib\site-packages
mechanize 0.1.10 is already the active version in easy-install.pth

Installed c:\python25\lib\site-packages\mechanize-0.1.10-py2.5.egg
Processing dependencies for mechanize==0.1.10
Traceback (most recent call last): File "C:\Dokumente und Einstellungen\Bill Gates\Desktop\mechanize-0.1.10\setup.py", line 156, in <module> main()
File "C:\Dokumente und Einstellungen\Bill Gates\Desktop\mechanize-0.1.10\setup.py", line 151, in main packages = packages,
File "C:\Python25\lib\distutils\core.py", line 151, in setup dist.run_commands()
File "C:\Python25\lib\distutils\dist.py", line 974, in run_commands self.run_command(cmd)
File "C:\Python25\lib\distutils\dist.py", line 994, in run_command cmd_obj.run()
File "C:\Python25\Lib\site-packages\setuptools\command\install.py", line 76, in run self.do_egg_install()
File "C:\Python25\Lib\site-packages\setuptools\command\install.py", line 104,in do_egg_install cmd.run()
File "C:\Python25\lib\site-packages\setuptools\command\easy_install.py", line211, in run self.easy_install(spec, not self.no_deps)
File "C:\Python25\lib\site-packages\setuptools\command\easy_install.py", line 427, in easy_install return self.install_item(None, spec, tmpdir, deps, True)
File "C:\Python25\lib\site-packages\setuptools\command\easy_install.py", line 478, in install_item self.process_distribution(spec, dist, deps)
File "C:\Python25\lib\site-packages\setuptools\command\easy_install.py", line 519, in process_distribution [requirement], self.local_index, self.easy_install
File "C:\Python25\lib\site-packages\pkg_resources.py", line 529, in resolve requirements.extend(dist.requires(req.extras)[::-1])
File "C:\Python25\lib\site-packages\pkg_resources.py", line 2108, in requires dm = self._dep_map
File "C:\Python25\lib\site-packages\pkg_resources.py", line 2100, in _dep_map for extra,reqs in split_sections(self._get_metadata(name)):
File "C:\Python25\lib\site-packages\pkg_resources.py", line 2519, in split_sections for line in yield_lines(s):
File "C:\Python25\lib\site-packages\pkg_resources.py", line 1813, in yield_lines for ss in strs:
File "C:\Python25\lib\site-packages\pkg_resources.py", line 2122, in _get_metadata for line in self.get_metadata_lines(name):
File "C:\Python25\lib\site-packages\pkg_resources.py", line 1140, in get_metadata_lines return yield_lines(self.get_metadata(name))
File "C:\Python25\lib\site-packages\pkg_resources.py", line 1137, in get_metadata return self._get(self._fn(self.egg_info,name))
File "C:\Python25\lib\site-packages\pkg_resources.py", line 1197, in _get return self.loader.get_data(path) zipimport.ZipImportError: bad local file header in c:\python25\lib\site-packages\mechanize-0.1.10-py2.5.egg

Verfasst: Montag 2. März 2009, 13:37
von Leonidas
Deine setuptools scheinen kaputt zu sein. Du solltest versuchen sie mal komplett zu löschen (+ easy_install.pth und setuptools.pth) und neu zu installieren.

Für mechanize reicht es aber wenn du den ``mechanize``-Ordner aus dem Tarball in ``site-packages`` kopiert. Da muss sowieso nichts kompiliert werden.

Verfasst: Montag 2. März 2009, 14:27
von Bong-Jour
Stimmt... Auf dem Linuxserver ging der Install.. Dann erstmal danke und bis später, wenn ich dir mitteile, dass es trotz mechanize immer noch nicht klappt :D

Verfasst: Sonntag 8. März 2009, 20:03
von Bong-Jour
Oder auch nicht... Es hat nämlich weniger am Cookie, sondern an meiner Blödheit gelegen.. :D




Thanks 4 help, Mister Leonidas ^^