Reading data from csv file, I keep getting errors

Asked by mr17 on 2013-06-24

I have test case and the csv file , but I keep getting erros while sst is trying to do compile(source, filename, mode, PyCF_ONLY_AST).Are there limitations on how the data in csv should be formated ? This is what my csv file looks like .

event_name^category^description^cost^recurrence^start_date^end_date^start_time^end_time^location^address^city^state^country^zipcode^sponsor^contact_name^contact_email^phone^website^test_result^required_fields
Test Event 21770^R5_1^Test Description^855^True^2013-06-20^2014-06-20^02:20 AM^02:20 PM^Rea Automation^4886 Darrel Avenue^Rea^MO^MX^64480^Sponsor^Chloe^<email address hidden>^573-221-9895^gtxcel.com^pass^['event_name', 'category', 'cost', 'description']
^R5_1^Test Description^978^False^2013-06-20^2014-06-20^02:20 AM^02:20 PM^Blum Automation^2957 Glen Meadow Circle^Blum^TX^MX^76627^Sponsor^Billie^<email address hidden>^469-816-3558^gtxcel.com^fail^['event_name', 'category', 'cost', 'description']
Test Event 21348^^Test Description^649^False^2013-06-20^2014-06-20^02:20 AM^02:20 PM^Dodge Automation^5124 Fleetwood Oaks Drive^Dodge^NE^US^68633^Sponsor^Alan^<email address hidden>^775-456-2287^gtxcel.com^fail^['event_name', 'category', 'cost', 'description']

sst-run r5_calendar.py --with-flags=qa1
--------------------------------------------------------------
starting SST...

  date time: 2013-06-24 11:29
  test directory: '.'
  report format: 'console'
  browser type: 'Firefox'
  shared directory: None
  screenshots on error: False
  failfast: False
  debug: False
  headless xserver: False

  Reading data from 'r5_calendar.csv'... --------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/bin/sst-run", line 8, in <module>
    load_entry_point('sst==0.2.3', 'console_scripts', 'sst-run')()
  File "/Library/Python/2.7/site-packages/sst/scripts/run.py", line 95, in main
    extended=cmd_opts.extended_tracebacks,
  File "/Library/Python/2.7/site-packages/sst/runtests.py", line 92, in runtests
    extended=extended,
  File "/Library/Python/2.7/site-packages/sst/runtests.py", line 207, in get_suites
    and not os.path.split(root)[1].startswith('_')
  File "/Library/Python/2.7/site-packages/sst/runtests.py", line 247, in get_suite
    for row in get_data(csv_path):
  File "/Library/Python/2.7/site-packages/sst/runtests.py", line 602, in get_data
    value = ast.literal_eval(field)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    Test Event 21770
             ^
SyntaxError: invalid syntax

Question information

Language:
English Edit question
Status:
Solved
For:
selenium-simple-test Edit question
Assignee:
No assignee Edit question
Solved by:
mr17
Solved:
2013-06-25
Last query:
2013-06-25
Last reply:
mr17 (marsel) said : #1

I realized that ast.literal_eval(field) is trying to evaluate each field and its not returing string all the time like I thought first . I simplyfied dtest data and seems to be working as expected.

Corey Goldberg (coreygoldberg) said : #2

glad you got it working. feel free to post an Issue if you think there is a bug in the csv handling.

-Corey