0

I am trying to run use PBBT to call in input of a .yaml file which will then run the .py file. But I keep getting the following error "yaml.constructor.ConstructorError: expected a sequence of test records in "input12sys.yaml",line 3 column 3" (edit). I will attach the actual python bit for both the input file and the .yaml. So everyone can see what I might be/am doing wrong.

Any help getting this working properly would be greatly apprecaited as I am a novice at this whole pbbt thing. Here is the .py file we want to have ran with the .yaml for pbbt (Daniel_Rogers_HW2.py is the file name)

import sys
# create a list
list2 = [4, 5, 1, 3, 7, 2, 5]
SumList = sum(list2)
print ("Dear Daniel")
print (*list2 , sep = " + ", end ='')
print (" =" , SumList)

Here is the .yaml file (edited)

output: output12sys.yaml
tests:
   py: Daniel_Rogers_HW2.py
   except: ValueError

And here is the error that I am getting when running pbbt input12sys.yaml -T enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Daniel Rogers
  • 75
  • 1
  • 7

1 Answers1

0

Your YAML file starts with:

import yaml

output:

And you cannot have a non-quoted multi-line scalar (import yaml\n\noutput) as a key for mapping. You probably just want to delete the import yaml line and if not you need to apply quotes:

"import yaml

output": output12sys.yaml

Assuming that import yaml is erroneous, you probably want to review your pbbt documentation, as the value for tests should be a list judging from https://bitbucket.org/prometheus/pbbt/src/default/. I.e. look like

output: output12sys.yaml
tests:
-  py: Daniel_Rogers_HW2.py    # note the list item indicator at the start of the line
   except: ValueError
Anthon
  • 69,918
  • 32
  • 186
  • 246
  • Anthon, I made the change as you recommended and now I am getting "yaml.scanner.ScannerError: mapping values are not allowed in this context in 'input12sys.yaml", line 5, column 6". I am confused because there is no acutal line 5? ` output: output12sys.yaml tests: except: ValueError py: Daniel_Rogers_HW2.py ` Is there a proper way to essentially end the file? – Daniel Rogers Sep 30 '19 at 14:53
  • Not sure how your file looks like after the edit. Are you editing the file on Unix/Linux and running the software on windows? – Anthon Sep 30 '19 at 15:28
  • its on windows. I will edit the original post to show how it is looking now and the current error for a line that does not exist so you can see that. – Daniel Rogers Sep 30 '19 at 16:06
  • I updated my answer, you should probably re-consult your pbbt documentation, as this has no longer anything to do with YAML. – Anthon Sep 30 '19 at 20:55