473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PyYAML: How to register my yaml.YAMLObject subclasses?

I suspect the solution to my problem is something really trivial.

I wrote a module called pitz that contains a class Issue:
>>pitz.Issue.yaml_tag
u'ditz.rubyforge.org,2008-03-06/issue'

Then I try to load a document with that same tag, but I get a
ConstructorError:

ConstructorError: could not determine a constructor for the tag
'!ditz.rubyforge.org,2008-03-06/issue'

I think there's some namespace/scoping problem, because when I define
the same class in my interpreter and then run yaml.load(issue_file),
everything works OK.

So, how do I tell yaml to build pitz.Issue instances when it runs across
that tag?

Do I need to use add_constructor? If so, I'd *really* appreciate some
example usage.

Thanks!

Matt
Oct 11 '08 #1
0 1303

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Wilk | last post by:
Hi, It seems that the link for python-yaml on the http://yaml.org main page is loose (http://iron.cx/yaml) :-( Anybody knows what's append ? What do you use ? pure python-yaml or syck ? ...
20
by: Chris S. | last post by:
Is there any benefit to Pickle over YAML? Given that Pickle is insecure, wouldn't it make more sense to support a secure serialization format, one that's even readable to boot, such as YAML?...
30
by: Reinhold Birkenfeld | last post by:
Hello, I know that there are different YAML engines for Python out there (Syck, PyYaml, more?). Which one do you use, and why? For those of you who don't know what YAML is: visit...
0
by: Phlip | last post by:
YAML? YAML YAML? Yet Another Missing Library? Is there a YAML implementation for C++? Need I remind y'all how easily one can implement YAML using Brand X?
1
by: Imbaud Pierre | last post by:
I began using pyYaml. I found no place where pyYaml users exchange ideas, know-how, etc (as here for python). There is a wiki, a bug tracker, documentation, but such a place (mailing list,...
0
by: Stephen Moore | last post by:
hello I have a situation where I have quite a large python object which I want to convert to yaml so I can then send it to a flex application using pyamf. I've managed to create a yaml...
0
by: Kirill Simonov | last post by:
Stephen Moore wrote: Try yaml.safe_dump(). !!python/tuple
0
by: Kirill Simonov | last post by:
======================== Announcing PyYAML-3.06 ======================== A new bug fix release of PyYAML is now available: http://pyyaml.org/wiki/PyYAML Changes
2
by: sshub | last post by:
I am using YAML module(Config:YAML) for one of the perl script. When i run the script, i get an error saying like ' Can't locate YAML.pm in ..........'. The error is pointing to a line 7 of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.