2014-10-10 9 views
1

爲我的其中一個項目安裝依賴項時,出現錯誤的編組數據錯誤。如果我們使用標準virtualenv進行安裝,它可以正常工作而不會出錯。在zc.buildout中安裝私有python lib時出現錯誤的Marshall數據

這裏是我的zc.buildout的一部分(目前導致該錯誤被註釋掉的部分):

[buildout] 
versions = versions 
extensions = mr.developer 
unzip = true 
include-site-packages = false 

# FIXME 
# Attempting to install from here via buildout raises a bad marshal data error 
# I should note that this errors does _not_ occur when we install in a 
# clean virtual environment. It only happens in buildout. 
# find-links = https://<myuser>:<mypass>@www.reportlab.com/pypi/simple/rlextra/ 

# Temporary solution, we included the package manually and will add it as 
# a develop egg, then in the "django" part further down, we need to 
# include the package in the extra-paths. 
develop = ${buildout:directory}/libs/rlextra-3.1.9 

回溯:

Getting distribution for 'rlextra==3.1.9'. 
zip_safe flag not set; analyzing archive contents... 
rlextra.thirdparty.xlrd.xlsx: module references __file__ 
rlextra.utils.buildutils: module references __file__ 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1973, in main 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1954, in with_ei_usage 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1977, in <lambda> 

    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup 
    dist.run_commands() 
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 360, in run 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 584, in easy_install 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 634, in install_item 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 829, in install_eggs 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1109, in build_and_install 

    File "build/bdist.linux-x86_64/egg/setuptools/command/easy_install.py", line 1095, in run_setup 

    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 33, in run_setup 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 81, in run 
    File "build/bdist.linux-x86_64/egg/setuptools/sandbox.py", line 35, in <lambda> 
    File "setup.py", line 78, in <module> 
    File "setup.py", line 73, in main 
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup 
    dist.run_commands() 
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands 
    self.run_command(cmd) 
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command 
    cmd_obj.run() 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 227, in run 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 266, in zip_safe 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 402, in analyze_egg 
    File "build/bdist.linux-x86_64/egg/setuptools/command/bdist_egg.py", line 433, in scan_module 
ValueError: bad marshal data (unknown type code) 
An error occured when trying to install rlextra 3.1.9. Look above this message for any errors that were output by easy_install. 

有誰知道什麼可能會導致這問題以及如何解決問題。我們目前正在通過手動下載和包含軟件包來管理這個(正如你可以在buildout配置中看到的那樣),這並不理想。

+1

什麼是完整的回溯錯誤? '糟糕的marshall數據'聽起來像你在庫中有'.pyc'文件,這些文件是用於錯誤的Python版本或者被破壞的。 – 2014-10-10 10:20:32

+0

添加了回溯。這就是說我不認爲python版本可能是原因。我會檢查 – Andre 2014-10-10 10:41:58

+0

zip安全掃描失敗;嘗試加載'.pyc'文件,該文件使用'marshall'來存儲代碼對象和常量值,並且加載'.pyc'文件是失敗的。由於pip不支持雞蛋,因此您不會看到這個問題。否則不清楚爲什麼你的蛋中的一個.pyc文件無法加載。 – 2014-10-10 10:54:46

回答

2

我認爲這可能與我們用來混淆被認爲是專有文件的方式有關。直到3個月前,我們希望隱藏的模塊以原始pyc文件形式傳輸,後綴指示其python版本,例如rml2pdf_27.pyc,rml2pdf_33.pyc等。

現在我們傳輸一個包含嵌入編譯後的代碼作爲數據,所以它現在不應該被打包商看到。這個改變發生在3.1.9創建之後。

+0

謝謝!升級到3.1.38解決了這個問題:) – Andre 2014-10-10 11:59:38