PD_Gear_ViewProviderPythonFeature is not JSON serializable

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: ViewProviderPythonFeature is not JSON serializable

Post by jriegel »

I did the icon. Its basically a placeholder. I'm particularly bad with icons :)
Stop whining - start coding!
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: PD_Gear_ViewProviderPythonFeature is not JSON serializab

Post by microelly2 »

I have a similar problem

Code: Select all

def createManager(name='My_Manager'):
	obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
	obj.addProperty("App::PropertyInteger","intervall","params",
						"intervall")

	obj.addProperty("App::PropertyPythonObject","run","zzz",	"run")
	obj.addProperty("App::PropertyLinkList","targets","zzz",	"targets")
	obj.addProperty("App::PropertyString","text","params",		"text")
	_Manager(obj)
	_ViewProviderManager(obj.ViewObject)
	return obj
when I save the file I get
raceback (most recent call last):
File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
<type 'exceptions.TypeError'>: <group object> is not JSON serializable
after reopen
Traceback (most recent call last):
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
<type 'exceptions.ValueError'>: No JSON object could be decoded
<unknown exception traceback><type 'exceptions.AttributeError'>: 'module' object has no attribute 'instancemethod'
second file save without errors
second reopen
<unknown exception traceback><type 'exceptions.AttributeError'>: 'module' object has no attribute 'instancemethod'
The connection of the proxis to my group objects are lost
At the moment I use the workaround after reload

Code: Select all

for ob in FreeCAD.ActiveDocument.Objects:
	if hasattr(ob,'Proxy'):
		ob.Proxy.__init__(ob)
		print("init " +ob.Name)


But the question is
Is it an error of me
or
is it caused by the non serializebility of group object
and can be fixed ??

thanks in advance
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: PD_Gear_ViewProviderPythonFeature is not JSON serializab

Post by bejant »

arcol wrote:A completely unrelated problem:
The gear generator icon is grey on grey (the ubuntu menu's background is grey), so completely unnoticable, until you hover the mouse on the menuitem.

Who designed the icon? Can he/she add a white around the gear icon, so it would be noticable?
wmayer wrote:Don't know but we are aware of this issue. Jim recently offered some alternatives but AFAIR there was still no decision which one to use. @Jim, is there a preferred icon we should use?
jriegel wrote:I did the icon. Its basically a placeholder. I'm particularly bad with icons :)
I think the icon has since been updated; for me it looks like this (only not 64 x 64 pixels), and has for a while now:
Image

OS: Ubuntu 12.04.5 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.15.4129 (Git)
Branch: master
Hash: 4259a9391bf9574cae9402dbba71acf9d74bcf41
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 6.7.1
Post Reply