Cgfx plugin doesn't load in mayapy, but does in maya -batch

Hey guys, I’m trying to run some batch operations in mayapy. I’m on OSX. The problem is when I when I load one of our scenes, I get an error saying the cgfx plugin won’t load.

The error:

Warning: file: /path/to/file.ma line 213: Unrecognized node type 'cgfxShader'; preserving node information during this session.
File read in 0 seconds.
Warning: Errors have occurred while reading this scene that may result in data loss.
Error: file: /path/to/file.ma line 6: Unqualified video card : Offscreen contexts not supported. CgFx plugin will not be loaded.
Error: file:  /path/to/file.ma line 6: initializePlugin function failed (cgfxShader)

Well that’s a bummer. Cgfx is an essential part of our pipeline, and I need to get data from those materials. The error “Unqualified video card : Offscreen contexts not supported.” doesn’t seem to be true, because I can wrap the same scripts in a mel python command and run them from maya in batch mode. I tried loading the plugin, but got a similar error.

If I query the type of the node in mayapy, it returns ‘unknown,’ because the plugin failed to load.

>>> pm.PyNode('material_name').type()
u'unknown'

However, if I do this exact same thing in the standalone maya prompt I get no errors when the scene loads, and I can see that the object is of type cgfxShader…

mel: python("pm.PyNode('material_name').type()")
Result: cgfxShader

Anyone know how I might solve or troubleshoot this?

I don’t have any insight, but I have just hit this same error… :frowning:

Edit: Win7 x64, maya 2013.5

Edit 2: at a cursory glance, it seems the files that failed are the files saved with Viewport 2.0 as the active renderer. when the batch process tries to open the file, it must be bombing when trying to create the renderer. I wonder if there is a way to force default viewport on files when they are opened…