# Run python command in .travis.yml

**URL:** <https://travis-ci.community/t/run-python-command-in-travis-yml/4150>\
**Category:** Python\
**Created:** [July 10, 2019, 2:48pm UTC](https://travis-ci.community/t/run-python-command-in-travis-yml/4150 "2019-07-10T14:48:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dizcza](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dizcza/32/2218_2.png) [@dizcza](https://travis-ci.community/u/dizcza)\
**Post date:** [July 10, 2019, 2:48pm UTC](https://travis-ci.community/t/run-python-command-in-travis-yml/4150/1 "2019-07-10T14:48:49Z")

</div>

I want to run a python command in a .travis.yml. Example:  
`python -c "import numpy as np"`  
If I put this line directly in .travis.yml, the build parser fails because of the `-c` in the line. Snippet from .travis.yml:

```auto
...
- python -c "import numpy as np"
...

```

As I understand correctly, all lines in .travis.yml should start with a “`-`” sign.  
How can I run this command, not creating a separate bash file (because then I could not see which line produces which log output)? I tried to avoid the `\` with `- python \-c "import numpy as np"`, but it does not help.  
Thank you.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [July 10, 2019, 3:05pm UTC](https://travis-ci.community/t/run-python-command-in-travis-yml/4150/2 "2019-07-10T15:05:05Z")

</div>

> <https://stackoverflow.com/questions/19109912/do-i-need-quotes-for-strings-in-yaml>

---

<div class="post-metadata">

**Author:** ![dizcza](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dizcza/32/2218_2.png) [@dizcza](https://travis-ci.community/u/dizcza)\
**Post date:** [July 10, 2019, 3:14pm UTC](https://travis-ci.community/t/run-python-command-in-travis-yml/4150/3 "2019-07-10T15:14:32Z")

</div>

Apparently, the current travis build version handles the code I describe above, even without the quoting stuff. Sorry for the false alarm. Hope it will remain the in future.
