pyYAML constructor
Fabrizio Pollastri <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I am trying to use the PyYAML capability to construct instances of python
objects, but when I run the following program, it seems to me that no instance
of the class Test appears. What I am missing? What is wrong? My system is Ubuntu
with packages libyaml-0-1 0.1.1-1 and python-yaml 3.05-2. Thanks in advance for
any help.
----
#!/usr/bin/python
import yaml
class Test(yaml.YAMLObject):
yaml_tag = u'!Test'
def __init__(self, name):
self.name = name
def __repr__(self):
return "%s(name=%r)" % (self.__class__.__name__, self.name)
yaml.load("""
--- !Test
name: my name is Test
""")
print globals()
print locals()
----
F. Pollastri
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/