Take pictures from python without using GUI
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Take pictures from python without using GIU
Thanks for the description. The point is not related to Python but to the fact that you run it inside a batch file. To close the terminal you have to add "exit" at the end of the .bat file.
Re: Take pictures from python without using GIU
Hello wmayer,
thanks.
but it does not work.
Sometihg like this in the bat file
"C:\Progra~1\FreeCAD_0_16\bin\python two_holes_part_with_photo.py
echo "ok"
exit"
does not even return the echo display.
Regards,
Ignacio.
thanks.
but it does not work.
Sometihg like this in the bat file
"C:\Progra~1\FreeCAD_0_16\bin\python two_holes_part_with_photo.py
echo "ok"
exit"
does not even return the echo display.
Regards,
Ignacio.
Re: Take pictures from python without using GIU
Can you post your .py file and your .bat, please? If it contains some secret information then replace them with some standard stuff.
Re: Take pictures from python without using GIU
Hello wmayer,
thanks for your reply.
Even with the first code you posted I have the same problem
I Have uploaded the two files. I have changed the extension to txt because I can't upload files with extension .py or bat.
wmayer.txt rename to --> wmayer.py contains the first code you posted.
freecad_wmayer.txt rename to -->freecad_wmayer.bat is the .bat I use to execute. Although executing inside pycharm (no .bat needed) it happens the same. Thanks.
Regards,
Ignacio.
thanks for your reply.
Even with the first code you posted I have the same problem
I Have uploaded the two files. I have changed the extension to txt because I can't upload files with extension .py or bat.
wmayer.txt rename to --> wmayer.py contains the first code you posted.
freecad_wmayer.txt rename to -->freecad_wmayer.bat is the .bat I use to execute. Although executing inside pycharm (no .bat needed) it happens the same. Thanks.
Regards,
Ignacio.
Re: Take pictures from python without using GIU
No, idea why it doesn't work for you.
When I open a terminal (cmd.exe) and add the "exit" statement at the end of freecad_wmayer.bat then the terminal will be closed.
When I double-click on the freecad_wmayer.bat then I don't need the "exit" because the appearing terminal closes itself.
So maybe adding this at the end of the .py file solves it:
When I open a terminal (cmd.exe) and add the "exit" statement at the end of freecad_wmayer.bat then the terminal will be closed.
When I double-click on the freecad_wmayer.bat then I don't need the "exit" because the appearing terminal closes itself.
So maybe adding this at the end of the .py file solves it:
Code: Select all
import os
os.system("tskill python.exe")
Re: Take pictures from python without using GIU
Hello wmayer,
ok, I will test on monday at work ( at home I only have ubuntu)
By the way, where is the python interpreter located at ubuntu? Using PyCharm for developing python code I have to select a python interpreter and I want to use the freeCAD one. I also want to test the parameters modification from ubuntu.
Thanks for your interest in this issue. I really appreciate it.
Regards,
Ignacio.
ok, I will test on monday at work ( at home I only have ubuntu)
By the way, where is the python interpreter located at ubuntu? Using PyCharm for developing python code I have to select a python interpreter and I want to use the freeCAD one. I also want to test the parameters modification from ubuntu.
Thanks for your interest in this issue. I really appreciate it.
Regards,
Ignacio.
Re: Take pictures from python without using GIU
/usr/bin/pythonBy the way, where is the python interpreter located at ubuntu?
Re: Take pictures from python without using GIU
Hello,
I have tested it in another machine and in a laptop (both also with windows 7) and it works!!...so its something related to the configuration of my machine.
Anyway, the first time I executed in the laptop I got a python .exe error. Then a window appeared saying something like "windows has detected that a program has not worked properly. Some settings were applied in order to solve the problem". I don't know what type of settings were applied, but now there is no error in the executions in the laptop...
All three computers has the same corporative configuration, although in my machine I have many more things installed (including several python versions...)
If I comment the line mw.hide() of wmeyer.py In my machine the python get stuck in the freecad window, while in the laptop and in the other machine the freecad window opens and close. I have try to close it in my machine with mw.close(), mw.deleteLater() but still the python get sutck (it seems that FreeCAD.closeDocument(doc.Name) does not close the document)
Do you know if is there any setting that I can modify or somehting that could be changing the behavieur of freecad ?
thanks.
Regards,
Ignacio.
I have tested it in another machine and in a laptop (both also with windows 7) and it works!!...so its something related to the configuration of my machine.
Anyway, the first time I executed in the laptop I got a python .exe error. Then a window appeared saying something like "windows has detected that a program has not worked properly. Some settings were applied in order to solve the problem". I don't know what type of settings were applied, but now there is no error in the executions in the laptop...
All three computers has the same corporative configuration, although in my machine I have many more things installed (including several python versions...)
If I comment the line mw.hide() of wmeyer.py In my machine the python get stuck in the freecad window, while in the laptop and in the other machine the freecad window opens and close. I have try to close it in my machine with mw.close(), mw.deleteLater() but still the python get sutck (it seems that FreeCAD.closeDocument(doc.Name) does not close the document)
Do you know if is there any setting that I can modify or somehting that could be changing the behavieur of freecad ?
thanks.
Regards,
Ignacio.
Re: Take pictures from python without using GIU
Sorry, but I don't know what else you could look for.Do you know if is there any setting that I can modify or somehting that could be changing the behavieur of freecad ?
Re: Take pictures from python without using GIU
ok. Anyway thanks a lot for your support and for FreeCAD