Skip to main content
Post Reopened by PolyGeo
deleted 30 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ? WhatWhat modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ? What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

deleted 475 characters in body
Source Link
Sreeraj
  • 729
  • 7
  • 23

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ?

I doubt that the issue is in the given below lines of my python program (I am not sure about this; just a doubt on these lines).

from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')

Or is this error occuring because of some other lines in my python program ?

I don't know exactly.

What What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ?

I doubt that the issue is in the given below lines of my python program (I am not sure about this; just a doubt on these lines).

from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')

Or is this error occuring because of some other lines in my python program ?

I don't know exactly.

What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ? What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

Post Closed as "Needs more focus" by PolyGeo
added 2 characters in body; edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ?

I doubt that the issue is in the given below lines of my python program (I am not sure about this; just a doubt on these lines).

from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')

Or is this error occuring because of some other lines in my python program ? 

I don't know exactly.

What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ?

I doubt that the issue is in the given below lines of my python program (I am not sure about this; just a doubt on these lines).

from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')

Or is this error occuring because of some other lines in my python program ? I don't know exactly.

What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

I have a Python Program for doing some geoprocessing in QGIS. The starting of the Python program is given below.

import sys
from qgis.core import *
import qgis.utils
from qgis.gui import *
from PyQt4.QtGui import *
from PyQt4.QtCore import Qt
from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
from PyQt4.QtCore import QFileInfo
import processing
import os
import ogr
from osgeo import ogr, gdal
import math
import xlrd

..............................many other lines.................

I want to execute this python program from a Windows Batch File, that is .bat file; even without opening QGIS software.

For that, I created a .bat file as given below.

SET QGIS_PREFIX_PATH=C:\OSGeo4W\apps\qgis
call "C:/OSGeo4W/bin/o4w_env.bat"
SET PYTHONPATH=C:\OSGeo4W\apps\qgis\python;%PYTHONPATH%
SET PATH=%PATH%;C:\OSGeo4W\apps\qgis\bin

cmd /c python "C:/Users/Sreeraj/.qgis2/processing/scripts/Task3.py" 

Unfortunately, when I am executing this .bat file, in C:\WINDOWS\system32\cmd.exe , I am getting an error:

python.exe has stopped working 
A problem caused the program to stop working correctly. 
Windows will close the program and notify you if a solution is available.  

How can I solve this issue ?

I doubt that the issue is in the given below lines of my python program (I am not sure about this; just a doubt on these lines).

from qgis.core import QgsApplication
from PyQt4.QtGui import QApplication
QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis", True)
QgsApplication.initQgis()
sys.path.append('C:/OSGeo4W/apps/qgis/plugins')

Or is this error occuring because of some other lines in my python program ? 

I don't know exactly.

What modification do I have to make in .bat file or in my Python program, in order to solve this issue ?

Source Link
Sreeraj
  • 729
  • 7
  • 23
Loading