Modify

Ticket #66 (closed defect: worksforme)

Opened 6 years ago

Last modified 6 years ago

ScannerError in fetch_more_tokens

Reported by: Takanao Endoh <djmchl@…> Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

>>> import yaml
>>> yaml.load(" 'spam: %' ")
'spam: %'
>>> yaml.load(" spam: % ")
------------------------------------------------------------
Traceback (most recent call last):
  ...
  File "/Volumes/data/pylib/src/yaml/scanner.py", line 257, in fetch_more_tokens
    % ch.encode('utf-8'), self.get_mark())
ScannerError: while scanning for the next token
found character '%' that cannot start any token
  in "<string>", line 1, column 8:
     spam: % 
           ^

Attachments

Change History

comment:1 Changed 6 years ago by anonymous

Sorry, I missed.

>>> import yaml
>>> yaml.load(" spam: '%' ")
{'spam': '%'}
>>> yaml.load(" spam: % ")
------------------------------------------------------------
Traceback (most recent call last):
  ...
  File "/Volumes/data/pylib/src/yaml/scanner.py", line 257, in fetch_more_tokens
    % ch.encode('utf-8'), self.get_mark())
ScannerError: while scanning for the next token
found character '%' that cannot start any token
  in "<string>", line 1, column 8:
     spam: % 
           ^

comment:2 Changed 6 years ago by xi

  • Status changed from new to closed
  • Resolution set to worksforme

The error message speaks for itself: you cannot start a plain scalar with the % symbol. You need to quote the whole string with "..." or '...'.

See  http://yaml.org/spec/cvs/current.html#ns-plain-first-char%28c%29 and  http://yaml.org/spec/cvs/current.html#c-indicator

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.