2

I have saved a python script (named as 'Task3.py'). Currently, I will open QGIS and then run this Task3.py . This python script is saved in C:\Users\Sreeraj.qgis2\processing\scripts\Task3.py .

But, I want to write a Windows Batch File (Task3.bat), such that when I run this Task3.bat file, the Task3.py will get automatically executed (even without opening QGIS). This batch file script must be saved in E:\Sreeraj\Task Global Data CONVERSION\Split\Task3.bat .

How do I write Task3.bat (so that I can run Task3.py without even opening QGIS) ?

closed as off-topic by Erica, MaryBeth, whyzar, LaughU, Jochen Schwarze Dec 13 '18 at 15:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions relating to general IT or with no clear GIS component, are off-topic here but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software), Database Administrators (relational databases) and other SE sites" – Erica, MaryBeth, whyzar, LaughU, Jochen Schwarze
If this question can be reworded to fit the rules in the help center, please edit the question.

3
python C:\Users\Sreeraj.qgis2\processing\scripts\Task3.py
pause

Save this as Task3.bat in your E:\Sreeraj\Task Global Data CONVERSION\ folder. If your python PATH is set it should run your script.

  • 1
    After saving this as Task3.bat; when I am running this Task3.bat ; it is showing an error (error is displayed in C:\WINDOWS\system32\cmd.exe). The error displayed is : '' 'python' is not recognized as an internal or external command, operable program or batch file. '' . – Sreeraj Jan 18 '18 at 8:01
  • 1
    I solved the above commented error by adding the PATH to the Task3.bat . But, I am getting an error displayed as : " python.exe has stopped working. A problem caused the program to stop working correctly. " – Sreeraj Jan 18 '18 at 10:42
  • 1
    I missed to include 2 lines : '' from PyQt4.QtGui import * '' and '' app = QApplication([]) '' in Task3.py. When I added these 2 lines, the error : " python.exe has stopped working.'' is solved. Now, batch file is running and I am getting the required outputs perfectly. Thank You for your advice. – Sreeraj Jan 18 '18 at 11:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.