Python中文
首页
教程
问答
标签
搜索
登录
注册
文件上载问题pythonWindows cherypy
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>一条Python和一个新手。我尝试使用以下代码上载文件:</p> <pre><code>@cherrypy.tools.noBodyProcess() def POST(self,theFile=None): lcHDRS = {} for key, val in cherrypy.request.headers.iteritems(): lcHDRS[key.lower()] = val formFields = myFieldStorage(fp=cherrypy.request.rfile, headers=lcHDRS, environ={'REQUEST_METHOD':'POST'}, keep_blank_values=True) dt = datetime.now() date = dt.strftime('%Y-%m-%d') dt = dt.strftime('%Y%m%d%H%M%S') theFile = formFields['theFile'] theFile.filename = str(dt) + "file" shutil.copy2(theFile.file.name,os.path.join(absolutePath , theFile.filename)) ... ... </code></pre> <p>我检查了路径os.path.join操作系统(绝对路径,文件名)一切都很顺利。 问题是这些代码在Linux ubuntu上运行得很好,但在windows上却不行。 调用的错误是:<strong>已编辑</strong></p> ^{pr2}$ <p>我哪里出错了? 如果你需要其他信息,请告诉我。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我猜windows对启动程序有UAC限制,你有没有试过在管理员权限下运行脚本?在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
6 回答
无法使用Django\u mssql\u后端迁移到外部hos
8 回答
无法使用Django&Python3.4连接到MySql
6 回答
无法使用Django+nginx上载媒体文件
5 回答
无法使用Django1.6导入名称模式
8 回答
无法使用Django1.7和mongodb登录管理站点
4 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
3 回答
无法使用Djangockedi验证CBV中的字段
2 回答
无法使用Djangocketditor上载图像(错误400)
9 回答
无法使用Djangocron进行函数调用
5 回答
无法使用Djangofiler djang上载文件
4 回答
无法使用Djangokronos
6 回答
无法使用Djangomssql provid
10 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
6 回答
无法使用Djangomssq迁移Django数据库
7 回答
无法使用Djangonox创建用户
2 回答
无法使用Djangopyodb从Django查询SQL Server
8 回答
无法使用Djangopython3ldap连接到ldap
1 回答
无法使用Djangoredis连接到redis
1 回答
无法使用Django中的FK创建新表
1 回答