# How to run a Checkpoint in python

**URL:** <https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225>\
**Category:** Archive\
**Tags:** how-to, help-wanted\
**Created:** [May 28, 2020, 4:41pm UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225 "2020-05-28T16:41:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyle](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/kyle/32/18_2.png) [@kyle](https://discourse.greatexpectations.io/u/kyle)\
**Post date:** [May 28, 2020, 4:41pm UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225/1 "2020-05-28T16:41:22Z")

</div>

This article is for comments to: [https://docs.greatexpectations.io/en/latest/how\_to\_guides/validation/how\_to\_run\_a\_checkpoint\_in\_python.html](https://docs.greatexpectations.io/en/latest/how_to_guides/validation/how_to_run_a_checkpoint_in_python.html)

Please comment +1 if this How to is important to you.

---

<div class="post-metadata">

**Author:** ![kuberketes](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@kuberketes](https://discourse.greatexpectations.io/u/kuberketes)\
**Post date:** [December 21, 2020, 9:52am UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225/2 "2020-12-21T09:52:22Z")

</div>

on Windows I get an error when generating the python script this way.

```
  File "run_staging.chk.py", line 31
    context = DataContext("C:\ ***\*** \***\ge_example\great_expectations")
                          ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

```

i resolved by changing the line 31 from:

`context = DataContext("C:\***\ge_example\great_expectations")`

to adding the r:

`context = DataContext(r"C:\***\ge_example\great_expectations")`

this is because without the `r` windows thinks that the letter after \ is a special character.  
Should be a easy fix.

---

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://discourse.greatexpectations.io/u/nok)\
**Post date:** [March 3, 2021, 9:32am UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225/3 "2021-03-03T09:32:11Z")

</div>

The example is incorrect.  
`for batch in checkpoint["batches"]: `  
 →   
It should be  
`for batch in checkpoint.batches`

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [March 4, 2021, 3:22am UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225/4 "2021-03-04T03:22:52Z")

</div>

@nok Would you like to create a PR with the fix? Thank you!

---

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://discourse.greatexpectations.io/u/nok)\
**Post date:** [March 4, 2021, 4:46am UTC](https://discourse.greatexpectations.io/t/how-to-run-a-checkpoint-in-python/225/5 "2021-03-04T04:46:28Z")

</div>

sure, but I want to make sure this is not a bug.

As the old version of ge did use the dictionary key style to access.

In latest version, the legacy batch API requires to use the dot to access instead.

I feel we should fix the LegacyBatchAPI instead of changing the doc here?
