2012-02-18 47 views
4

我正在构建一个intial-data.yml文件来测试我的Play!应用程序,但是当我尝试加载页面时,在通过intial-data.yml文件读取时出现错误。这似乎能够解析的用户名,名字,和姓氏字段,但是当它到达的电子邮件,它吐出以下错误:为什么initial-data.yml不允许映射电子邮件的值?

play.exceptions.YAMLException: null; mapping values are not allowed here (in file /conf/initial-data.yml line 7, column 11) 
    at play.test.Fixtures.loadModels(Fixtures.java:234) 
    at Bootstrap.doJob(Bootstrap.java:12) 
    at play.jobs.Job.doJobWithResult(Job.java:50) 
    at play.jobs.Job.call(Job.java:146) 
    at Invocation.Job(Play!) 
Caused by: mapping values are not allowed here 
in "<reader>", line 7, column 11: 
     email:  [email protected] 
      ^

在我的YML文件的第一项如下所示:

# Test data 

User(Dan): 
    username: Username1 
    fname:  John 
    lname:  Doe 
    email:  [email protected] 
    password:  password1 

有没有人知道为什么会发生这种情况?

+0

也参看:http: //stackoverflow.com/questions/9055371/python-and-pyaml-yaml-scanner-scannererror-mapping-values-are-not-allowed-her – DNA 2012-02-18 23:57:20

回答

6

如果对齐列(emailpassword在你的榜样额外的1空间缩进)工程确定:

# Test data 

User(Dan): 
    username: Username1 
    fname:  John 
    lname:  Doe 
    email:  [email protected] 
    password:  password1 

online parser对于调试很有用...

+1

谢谢,那个链接真的很有用! – jbranchaud 2012-02-19 00:12:15

+0

我秒!它在yaml固定空间的痛苦。 – 2013-05-02 19:48:01

相关问题