datacamp-light icon indicating copy to clipboard operation
datacamp-light copied to clipboard

SCT Help

Open ChanceHarmon opened this issue 3 years ago • 1 comments

I am sure this a total noob question. I am using React and the boilerplate code for a python example.

    <div data-datacamp-exercise data-lang="python">
    <code data-type="pre-exercise-code">
      # no pec
    </code>
    <code data-type="sample-code">
      # Create a variable a, equal to 5


      # Print out a

    </code>
    <code data-type="solution">
      # Create a variable a, equal to 5
      a = 5

      # Print out a
      print(a)
    </code>
    <code data-type="sct">
      test_object("a")
      test_function("print")
      success_msg("Great job!")
    </code>
    <div data-type="hint">
      Use the assignment operator (<code>=</code>) to create the variable <code>a</code>.
    </div>
    </div>

However, no matter what I put in the editor to submit, I get this error every time.

DataCamp encountered the following error: Traceback (most recent call last): File "/var/lib/python/site-packages/protobackend/output.py", line 70, in wrapper output = f(*args, **kwargs) File "/var/lib/python/site-packages/pythonbackend/commands.py", line 63, in worker_dispatch return d.dispatch(cmd) File "/var/lib/python/site-packages/protobackend/dispatcher.py", line 28, in dispatch cmd_output = cmd(pre_payload) File "/var/lib/python/site-packages/pythonbackend/Exercise.py", line 123, in runSubmit self.dc_force_diagnose, File "/var/lib/python/site-packages/pythonwhat/test_exercise.py", line 57, in test_exercise exec(sct, sct_cntxt) File "", line 1 test_object("a") test_function("print") success_msg("Great job!") ^ SyntaxError: invalid syntax

I get the same error on localhost and deployed site, so I don't believe it is related to those, unless there is some kind of permissions issue I haven't came across in researching. I looked into pythonwhat and going down that path, but that seems like it shouldn't be needed to use the basic out of the box code base. Any help with this would be greatly appreciated.

ChanceHarmon avatar Dec 07 '21 01:12 ChanceHarmon

You are missing the javascript file declaration for datacamp light. Put this at the top of your code before:

<html>
<script src="https://cdn.datacamp.com/dcl-react.js.gz"></script>

DrMondesire avatar Apr 12 '22 03:04 DrMondesire