1

I call python from lua script this way:

for i=2000,2018 do
--prepare settings file for python
os.execute("C:\\InstallPython\\python.exe C:\\py+lua\\parser.py")
--work with database downloaded by python
end

Everything works fine, but I get annoying window every time Lua executes python script

1. Black window appears on each iteration 2. Black window dissapears on each iteration

How can I do it

1. without opening window or 2. call this window one time

Lunatic Python doesnt work for me due to problem described here: https://github.com/bastibe/lunatic-python/issues/67

Kosmonavt
  • 191
  • 2
  • 14
  • 1
    On Windows, to run a pyton script without console, you need to change the extension from .py to .pyw – Cyphall Oct 13 '18 at 08:07
  • 1
    @Cyphall yes, but not sure it would be enough, because lua shell probably opens a terminal no matter what. OP _should_ try using `.pyw` extension, yes that's the first thing to do, but that may not solve the issue. If you want to do that from python, you have to use subprocess & some NOWINDOW flags I don't remember exactly, and use pyw (or not) so the window doesn't show up – Jean-François Fabre Oct 13 '18 at 08:12
  • I don't have lua installed, but I don't think it's related to python. @Kosmonaut what happens when you're tring to open "notepad" instead? do you get the black window too? – Jean-François Fabre Oct 13 '18 at 08:25
  • have you tried this ? https://stackoverflow.com/questions/1689015/run-python-script-without-windows-console-appearing – Jean-François Fabre Oct 13 '18 at 08:43
  • os.execute("C:\\py+lua\\parser.pyw") and os.execute("C:\\InstallPython\\pythonw.exe C:\\py+lua\\parser.pyw") don't solve problem. Black window appears and dissapears on each iteration. – Kosmonavt Oct 13 '18 at 08:51
  • Does [this solution](https://stackoverflow.com/a/29758886/1847592) help? – Egor Skriptunoff Oct 13 '18 at 09:12
  • it has to be solved from the lua side: `os.execute` creates a _shell_. You have to run the process _without_ creating a shell, and without opening a window. It doesn't depend on the process you're running. aaand duplicate (google is your friend) – Jean-François Fabre Oct 13 '18 at 10:12

0 Answers0