Modify ↓
Ticket #219 (reopened defect)
A tab inside a scalar is not accepted
| Reported by: | py4fun@… | Owned by: | xi |
|---|---|---|---|
| Priority: | normal | Component: | pyyaml |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I got the exception when a tab character (\t) is located inside a scalar:
import yaml
yaml.load("36L\tDIESEL")
This is the output of the latest source:
File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\parser.py", line 143, in parse_implicit_document_start
StreamEndToken):
File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "C:\projects\py-workspace\pyyaml-trunk\lib\yaml\scanner.py", line 257, in fetch_more_tokens
% ch.encode('utf-8'), self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
in "<string>", line 1, column 4:
36L DIESEL
^
When the tab character is replaced with a space, the parser works properly.
This issue was originally reported for SnakeYAML: http://code.google.com/p/snakeyaml/issues/detail?id=136
Attachments
Change History
comment:2 Changed 18 months ago by anonymous
- Status changed from new to closed
- Resolution set to wontfix
Note: See
TracTickets for help on using
tickets.


I found the answer in scanner.py
def scan_plain_spaces(self, indent, start_mark): # See the specification for details. # The specification is really confusing about tabs in plain scalars. # We just forbid them completely. Do not use tabs in YAML!