0

I've created a project in Pycharm that is composed by 3 py scripts and requires a json file with authentication parameter to read files coming from google drive and finally a file to manipulate data in a sqlite table create on the fly.

That works super good in my computer and the server (windows server 2016 standard edition). I need to execute this program(script) whole days so I've tried with the script.py using cmdExec in SQL and Windows scheduler manager and it doesnt work. otherwise if manually in the server I perform double click that runs.

I realized that when I run the script manually the execution is C:\path of folder where is the script> C:\whole path again\script.py

Otherwise from windows scheduler is always: C:\windows\system32> C:\whole path again\script.py

How can I force to fix this path or probably if I can create a .exe of my project in pycharm that could work? But I've not found too much info about how follow this process.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Andres Urrego Angel
  • 1,842
  • 7
  • 29
  • 55

3 Answers3

1

If you want to create an exe you can use cx_Freeze or py2exe. However, you could also try an other way (such as .bat file).

Ryan
  • 1,972
  • 2
  • 23
  • 36
Zeecka
  • 11
  • 2
0

I think "pyinstaller" is the best choice. it can package a python program to an *.exe file. so you can execute this program om windows platform. And you don't need to install python on windows. office website is "http://www.pyinstaller.org/". it is easy to use.

note:pyinstaller don't support python3.6

hope to help you.

Bao Liwen
  • 1
  • 1
  • Sounds good. So, I went to pycharm I've already installed the package pyinstaller. I have tried to use it from cmd and python console according with the manual just doing : pyinstaller path\script.py but i cant create the .exe do you know how to use it? – Andres Urrego Angel Jul 27 '17 at 15:38
  • pyinstaller -F -w PYFILE you can refer the official document. -F for create one exe file. -w for hide cmd windows. also you can add -i for change the ico. – Bao Liwen Jul 27 '17 at 15:41
  • damn I`m Python 3.6 – Andres Urrego Angel Jul 27 '17 at 15:43
0

Hi guys finally after a research within our library contributions I found the follow link where another person shared the experience to create a bat file.

Finally following this post from another contributor I could figured out my issue and my bat scripts looks like:

@echo off
py -u "path\ReadFile.py"
echo %ERRORLEVEL%

Thanks everyone

Andres Urrego Angel
  • 1,842
  • 7
  • 29
  • 55