Pyblish plugins syntax error


I wrote some code in PyCharm and when i tried to register plugin i got Error: (invalid syntax (, line 1)).
The reason was that file contained \r\n tags instead of just \n.
I solved this problem by changing pyblish_base\pyblish\
six.exec_(, module.__dict__)
six.exec_('\r', ''), module.__dict__)

Is it a bug or i missed something ?


Hi @sega, thanks for reporting this.

Would you be able to post either the plug-in itself, or a reproducible here that I could have a look at? Also what OS are you on?


Hi @marcus.

I`m on Windows 7, using pyblish_lite with maya 2013.
I got the same error when i opened default plugins in pyblish_base/pyblish/plugins by WordPad and resaved them, thats why i decied to check file syntax.


Thanks @sega

Wordpad and other rich-text editors append additional metadata to plain text files that may break your source code. Try using a plain text editor or IDE, such as Notepad or Sublime Text.


I`m using PyCharm and just tried to test things with wordpad.
I will try to check same thing with sublime/atom.


Yes, sorry I completely missed you mentioned PyCharm. That should work without any problems.

Could you share some code that I could try on my end? There are many developers writing plug-ins in PyCharm without any problem so far.


Here it is:

import pyblish.api
import maya.cmds as mc

class RigCollector(pyblish.api.ContextPlugin):
    label = "Collect rigs"
    order = pyblish.api.CollectorOrder

    def process(self, context):
            name = mc.getAttr('')
  "Collecting: %s" % name)
            instance = context.create_instance(name, families=["rig"])
            instance[:] = mc.file(constructionHistory=True, exportSelected=True, preview=True, force=True)

class RigValidator(pyblish.api.InstancePlugin):
    order = pyblish.api.ValidatorOrder
    label = "Validate Rigs"
    families = ["rig"]

    def process(self, instance):"Validating: %s" % instance)
        assert "main_control" in instance, "%s is missing main_control" % instance

class RigExtractor(pyblish.api.InstancePlugin):
    order = pyblish.api.ExtractorOrder
    families = ["rig"]
    label = "My Extractor"

    def process(self, instance):"Extracting: %s" % instance)


Thanks @sega, I pasted the code here for completeness, but the file is kept in the history of the edits.

I’ll take a look at this soon, but for now, are you able to copy/paste the above into a new file and save that? This seems like an issue with this particular file. Worst case, try saving it in Notepad, and have a look at whether PyCharm has any settings for line-endings.


Copy-paste in notepad didn`t work, same error.