xiaojie0202 / IDC_Manage

数据中心资产管理系统,为简单而存在(2017年10月停止维护)
31 stars 12 forks source link

无法倒入xls数据,我将系统内的数据导出,然后倒入也是同样报错信息 #3

Open glider126 opened 5 years ago

glider126 commented 5 years ago

Environment:

Request Method: POST Request URL: http://192.168.41.122:9000/cabinet/%E5%8C%97%E4%BA%AC%E5%8C%97%E8%8B%91IDC%E6%9C%BA%E6%88%BF/%E5%8C%97%E4%BA%AC%E5%8C%97%E8%8B%91IDC%E6%9C%BA%E6%88%BF/import_cabinet/

Django Version: 1.11 Python Version: 3.6.5 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'dc_info.apps.DcInfoConfig', 'dc_user.apps.DcUserConfig', 'xadmin', 'crispy_forms', 'reversion'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'middleware.login.IsLoginMiddleware']

Traceback:

File "/usr/lib/python3.6/site-packages/openpyxl/reader/excel.py" in _validate_archive

  1. archive = ZipFile(filename, 'r', ZIP_DEFLATED)

File "/usr/lib64/python3.6/zipfile.py" in init

  1. self._RealGetContents()

File "/usr/lib64/python3.6/zipfile.py" in _RealGetContents

  1. raise BadZipFile("File is not a zip file")

During handling of the above exception (File is not a zip file), another exception occurred:

File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner

  1. response = get_response(request)

File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/root/IDC_Manage-master/dc_info/views/cabinet.py" in import_cabinet

  1. cabinet_files.file) # 交给函数出来文件

File "/root/IDC_Manage-master/dc_info/utils/handel_excel.py" in handel_import_cabinet

  1. wb = openpyxl.load_workbook(file)

File "/usr/lib/python3.6/site-packages/openpyxl/reader/excel.py" in load_workbook

  1. archive = _validate_archive(filename)

File "/usr/lib/python3.6/site-packages/openpyxl/reader/excel.py" in _validate_archive

  1. archive = ZipFile(f, 'r', ZIP_DEFLATED)

File "/usr/lib64/python3.6/zipfile.py" in init

  1. self._RealGetContents()

File "/usr/lib64/python3.6/zipfile.py" in _RealGetContents

  1. raise BadZipFile("File is not a zip file")

Exception Type: BadZipFile at /cabinet/xxxIDC机房/xxxIDC机房/import_cabinet/ Exception Value: File is not a zip file