-1
我正在尝试编写一个独立的QGIS Python脚本,以便在一夜之间执行计划任务,并且在导入处理模块时我会陷入困境 - 我得到的错误状态:“没有名为processing.core.Processing的模块”。我在网上搜索了一个解决方案,但似乎找不到任何可以使其工作的东西。下面就是我试图运行:调度QGIS处理作业
import sys
from PyQt4.QtGui import *
from qgis.core import *
# Initialize QGIS Application
app = QgsApplication([], True)
QgsApplication.setPrefixPath("C:\Program Files\QGIS Pisa\apps\qgis", True)
QgsApplication.initQgis()
# Add the path to Processing framework
sys.path.append('C:\Users\andreeam.popa\.qgis2\python\plugins\processing')
# Import and initialize Processing framework
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
print 'Hello QGIS!'
,这是批处理文件来启动上面:
REM Change OSGEO4W_ROOT to point to the base install folder
SET OSGEO4W_ROOT=C:\Program Files\QGIS Pisa
SET QGISNAME=qgis
SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME%
set QGIS_PREFIX_PATH=%QGIS%
REM Gdal Setup
set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal\
REM Python Setup
set PATH=%OSGEO4W_ROOT%\bin;%QGIS%\bin;%PATH%
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
set PYTHONPATH=%QGIS%\python;%PYTHONPATH%
REM Launch python job
python X:\FunGis\Workspaces\Andreea\MyScripts\QGIS_Scripts\test.py
pause"
任何想法表示赞赏。 谢谢。