debug flag



  • On 18/05/2013 at 02:51, xxxxxxxx wrote:

    is there a way to know from python if a plugin instance is in debug mode without having to
    search the various folders where the debug flag txt files can be placed ?

    __debug__ is always true for in c4d, while sys.flags.debug is always false. i was hoping
    c4d does reflect its debug status in the python environment or provides itself a debug 
    constant in c4d or something like that.

    happy rendering,
    ferdinand



  • On 18/05/2013 at 02:54, xxxxxxxx wrote:

    What do you mean by "plugin instance in debug mode"? I know C4D can be in debug mode using
    either -debug from the command-line or adding c4d_debug.txt to the C4D folder. But how can you
    put a Python plugin in debug mode?

    Anyway, maybe you can find -debug in sys.argv or the c4d_debug.txt in the C4D folder if that
    is what you want.

    Best,
    -Nik



  • On 18/05/2013 at 03:15, xxxxxxxx wrote:

    you can put just a single plugin into debug mode by placing the c4d_debug.txt file in the plugin 
    folder. you can also place the file in the user folder. that is what  i meant with various places.

    i was hoping the file is processed on a more general level by c4d, but it seems to be a cpp only
    memory leak feature. sys.argv is also empty for me.

    I guess I will use my old solution with a hardcoded boolean in the pyp loader file ;)



  • On 18/05/2013 at 03:44, xxxxxxxx wrote:

    Oh can you? I didn't know this. Is there something about this in the docs? What does it change then?

    Thanks,
    -Nik



  • On 18/05/2013 at 03:59, xxxxxxxx wrote:

    Well, I know from the cpp documentation where it is recommended as it is better / more
    performant than putting all plugins into debug mode. That is practically what I want to do 
    in python to. I have now written a little code chunk which places 'c4d_debug' as a fake 
    argument in the python argument variable table, when it does find a debug.txt file in the 
    same file the pyp loader is located in. so that each module can throttle its console output 
    depending on that variable. Would be cool though if maxon would consider to automate 
    that behaviour. It is easier to remove a file at the end than removing (various) booleans.

    from the cpp doc stability and testing :

    _Place c4d_debug.txt (an empty text file) inside the user directory (or the folder of  _
    the compiled plugin files) to find memory leaks.
    _
    _
    edit : as is  already said earlier, my main misconception was, that i did assume that
    c4d_debug.txt was working on a more general level, but is seems to be ignored by c4d for 
    python plugins as there are no memory leaks in python. at least not in a technical sense.



  • On 20/05/2013 at 00:40, xxxxxxxx wrote:

    Hi,

    If you take a look at the FAQ in the Python documentation:

    How do I run Python in verbose- or debug-mode?

    If you want to run Python in the verbose or debug mode, please create an empty text file in the user folder of CINEMA 4D:

    c4d_py_debug.txt  Run Python in debug mode.
    c4d_py_verbose.txt  Run Python in verbose mode.


Log in to reply