New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Howto get stdout output from cqparts/cadquery scripts #85
Comments
@gntech From within FreeCAD, you can use import FreeCAD
FreeCAD.Console.PrintMessage("Debug\r\n")
FreeCAD.Console.PrintError("Error!\r\n") At one time I had a |
@gntech Looking at the code, it looks like I implemented a print hook in a different way later on. I had forgotten about that. The following prints correctly to the "Report view" for me. print("HERE") |
@jmwright I run the script above from command line like so: $ python build_ct1.py
No handlers could be found for logger "cqparts.assembly"
Exporting assembly GLTF-model It is very strange, only the last print() statement gets printed Perhaps there is something about "No handlers could be found for logger" |
When I run the script from freecad all print statements are shown. However, it seems they are put on hold so everything prints after the script is done. |
This was also addressed in dcowden/cadquery#200 import cadquery
cadquery.freecad_impl.console_logging.enable()
import logging
log = logging.getLogger(__name__)
log.debug("not shown")
log.info("displayed as normal")
log.warning("shown in amber")
log.warning("shown in red") also, |
@gntech has this answered your question? |
Tanks for your suggestion. However, It will be some time before I will be able to test it. I will answer here then |
@gntech no problem. Take your time. |
Okay, I have done some troubleshooting and I think it comes down to the suppress_stdout_stderr()-function in cadqeury. I have opened a new issue there, see dcowden/cadquery#267 |
I like to have print() statements or log.info() statments in my code that shows information about script progress, calculated design values, and so on. Is it possible somehow? Right now it looks like it is swallowed by FreeCAD somehow. Sometimes I get the output from the script after the entire script is finished. I dont get error or tracebacks from the script which is annoying as well.
The text was updated successfully, but these errors were encountered: