Shell commands that work in interactive mode do not work when I run them as a script. For example:
#!/usr/bin/env ipython
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#Ingest the data into a giant DataFrame
cd data/raw/
If I type the above in the interactive shell, everything is working fine. If I run the script ./myScript.py
, or I just copy the code above and paste it in my interactive shell (starting at the first import), I get:
cd data/raw/
^
SyntaxError: invalid syntax
I feel I'm missing something obvious here but not sure what?