Debugger for the plugins created in Cinema4D
On 09/12/2013 at 08:05, xxxxxxxx wrote:
We have created a XML3DExporter plugin for Cinema4D and we are planning to add few more functionalities in it. So we need to debug the code.
Does Cinema4D has a debugger for the python plugin code or how can we debug the code with an external debugger?
Suggest me some ways to debug my python plugin code
On 09/12/2013 at 10:14, xxxxxxxx wrote:
Debugging is a rather vague term an people do understand multiple things under it. You can
debug in c4d itself with the c4d console, which is most likely the way most people are doing it.
Using the reload python plugins feature does make it a quite straight forward process. That
does assume that you are not trying to reload modules, as reloading modules in a python
instance before 2.7 is impossible due to the fact that you cannot overload import / establish a
hook to it (you can still use multiple files, just not in the __init__.py fashion or if you do, you have
to restart c4d each time you made a change to a module).
There is also the theoretical possibility to remote debug, but it is practically very difficult IMHO.
Here is an article about it :
If you mean by debugging also having an inspector / live insight into the memory used by python,
that is not possible for c4d.
On 10/12/2013 at 01:48, xxxxxxxx wrote:
If you are working with modules that are distributed with your plugin, it is easily possible to
automatically reload them when you reload the Python plugins in Cinema (and actually required!).
Check out the following link:
2. If you reload your plugin from Cinema 4D, the locally loaded libraries will automatically be reloaded
For debugging, you can use the Python pdb module which is part of the standard library.
On 10/12/2013 at 03:00, xxxxxxxx wrote:
unless i am mistaken that isn't the module workflow you are showing there nikklas. that
is the usual 'I do throw everything into the sys.path' approach. which is fine, but not the same
as true python modules.
the problem for python modules is, that python does create copies of them per instance and
you are not able to track those unless you are at least on python 2.7 and do establish a hook
on the import function (or use python 3.2 which covers module reloading out of the box -
here is a github for python 2.7 on the topic https://github.com/jparise/python-reloader.
of course there is a lot of black magic like deleting reference strings in sys and the environment
variable. but those will fail in 99% of the cases in my experience.
On 10/12/2013 at 09:19, xxxxxxxx wrote:
Here importing the c4d is the main error in the code because it is not available in Eclipse editor. How could I proceed?
On 10/12/2013 at 10:19, xxxxxxxx wrote:
read the link on remote debugging i have posted.