问题描述
这里是设置-这是一台Windows 2016 Server,以Apache作为Web服务器。 subprocess
调用如下:
subprocess_results = subprocess.run(['pgsql2shp','-f',<path-to-output-shapefile>,'-h','127.0.0.1','-u',<user_name>,'-P',<password>,'database_name','SELECT * FROM temp'],capture_output=True)
当我在开发中运行此文件(manage.py runserver
)时,shapefile在<path-to-output-shapefile>
处创建。但是,如果尝试在Apache生产服务器中运行它,则subprocess_results.returncode
返回0,但是没有shapefile写入<path-to-output-shapefile>
。我检查了以下内容:
- postgresql表确实存在。
-
<path-to-output-shapefile>
的文件夹权限对SYstem
,Administrators
,USERS
和我的用户帐户具有“完全控制”权限。 - 我已经在管理PowerShell中运行
pgsql2shp
命令,并且shapefile被创建。
有人可以告诉我我可能做错了什么吗?这是Django设定吗?是我缺少的Apache配置吗?
编辑:
在我所有的SO搜索中,直到发布此问题后,我才能找到this answer。提供pgsql2shp.exe的绝对路径可以解决该问题,并且现在正在创建shapefile。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)