我希望网站上的excel文件在点击时在Excel中打开,不会保存在桌面上,或者在浏览器中嵌入打开等等.现在显然这一切都取决于每个用户的所有配置,但最好的内容类型是什么和其他设置,以实现大部分时间?
我正在尝试使用Python在Windows操作系统上创建和写入临时文件.我使用Python模块tempfile创建了一个临时文件.
但是当我去写那个临时文件时,我收到了一个错误Permission Denied.我不允许写临时文件吗?!难道我做错了什么?如果我想创建和写入临时文件,我应该如何在Python中执行此操作?我想在临时目录中创建临时文件以用于安全目的而不是在本地(在.exe执行的目录中).
IOError: [Errno 13] Permission denied: 'c:\\users\\blah~1\\appdata\\local\\temp\\tmpiwz8qw'
temp = tempfile.NamedTemporaryFile().name
f = open(temp, 'w') # error occurs on this line
Run Code Online (Sandbox Code Playgroud) 我正在使用Django 1.7.4和django_ajax_selects进行自动完成.
查找失败,我收到此错误:
__init __()得到了一个意外的关键字参数'mimetype'
完整的堆栈跟踪如下.我该怎么做才能解决这个错误?
是否可以调用GET而不是POST.django_ajax_select是否进行了GET而不是POST?
TypeError at /autocomplete/lookup/ajax_lookup/TableItemLookup
__init__() got an unexpected keyword argument 'mimetype'
Request Method: GET
Request URL: http://127.0.0.1:8999/RESTO/autocomplete/lookup/ajax_lookup/TableItemLookup?term=Sam
Django Version: 1.7.4
Python Executable: C:\Apache Software Foundation\Apache2.2\bin\httpd.exe
Python Version: 2.7.6
Python Path: ['C:\\Python27\\lib\\site-packages\\setuptools-2.0.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django_debug_toolbar-0.11.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\requests-2.2.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\suds_jurko-0.6-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\elaphe-0.6.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pillow-2.3.0-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\ghostscript-0.5dev-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\south-0.8.3-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\crochet-1.0.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\django_ajax_selects-1.3.4-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\scrapy-0.22.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\six-1.7.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\cssselect-0.9.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pyopenssl-0.14-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\queuelib-1.1.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\w3lib-1.6-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\python_dateutil-1.5-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\memory_profiler-0.32-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\cython-0.21.1-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\line_profiler-1.0-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\pika-0.9.14-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\pyws-1.1.5-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\nose-1.3.4-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\jinja2-2.7.3-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\httplib2-0.9-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\argparse-1.3.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\soapfish-0.6dev-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\soapbox-0.3.8.dev-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\num2words-0.5.2-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\unidecode-0.04.17-py2.7.egg', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\Lib', 'C:\\Python27\\DLLs', 'C:\\Python27\\Lib\\lib-tk', 'C:\\Apache Software Foundation\\Apache2.2', 'C:\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python27', …Run Code Online (Sandbox Code Playgroud)