Example for PluginMessage is failing



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/12/2012 at 17:25, xxxxxxxx wrote:

    I'm trying to run R13 with -nogui and have a plugin dynamically generate some C4D files at startup (and then shutdown).

    The docs say to implement PluginMessage; check if the ID is equal to C4DPL_COMMANDLINEARGS and then use sys.argv.

    However, when I tried to do that only an error is raised:

    AttributeError
        'module' object has no attribute 'argv'

    So... how do I access the command line arguments given to the executable? (This is on Windows, BTW.)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/12/2012 at 01:43, xxxxxxxx wrote:

    Are you sure you call argv on sys module and not on another?
    Also, you may have an issue with Python on your computer because this should work.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/12/2012 at 10:12, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Are you sure you call argv on sys module and not on another?
    Also, you may have an issue with Python on your computer because this should work.

    Yes. Here's "all" the code from the plugin:

    import c43, sys
      
    def PluginMessage(id, data) :
    	if id == c4d.C4DPL_COMMANDLINEARGS:
    		print sys.argv
    		return True
      
    	return False
    

    That's more or less what the docs for R13 say to do to get the command line arguments. But no dice.

    The box is a fresh Windows Server 2012 RTM English 64Bit. I didn't install Python (I thought that C4D brought its own).

    So what am I doing wrong?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/12/2012 at 11:26, xxxxxxxx wrote:

    there is a typo in your import statement.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/12/2012 at 15:42, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    there is a typo in your import statement.

    Sorry, I hand-typed that because the virtual machine didn't sync clipboards. It's actually c4d.

    However, upgrading to the latest version of R13 (061) appears to have fixed things up.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/12/2012 at 18:41, xxxxxxxx wrote:

    Hi, I can confirm all versions after R13.061 have this fix included.

    Cheers, Seb


Log in to reply