0

I have a basic question about how to package a python script with a local copy of a module, in this case the yaml module, so that i can run it on another machine and not have to download/install the module.

I tried taking the 'yaml' directory from the repo on github, putting it in the root of my python script, and simply running an import statement, but that doesn't seem to work; when i run import yaml or from yaml import load, my script fails with exception unexpected token '='.

I'm sure that I'm missing something obvious, but I wasn't able to find a clear answer by looking around for a bit. Any help would be appreciated.

DJMcCarthy12
  • 3,819
  • 8
  • 28
  • 34
  • Your error appears to be completely unrelated to the rest of your question. – roganjosh Oct 31 '18 at 23:42
  • I thought that as well, but it is for sure failing during the line where I import yaml, so was thinking maybe I missed something and the module isn't importing properly. – DJMcCarthy12 Oct 31 '18 at 23:43
  • Possible duplicate of [Is there a way to embed dependencies within a python script?](https://stackoverflow.com/questions/11436777/is-there-a-way-to-embed-dependencies-within-a-python-script) – CTheCheese Oct 31 '18 at 23:44
  • The first thing you should do is include the full traceback – roganjosh Oct 31 '18 at 23:45
  • Can you update your question to show us the full stack trace and error message? – killian95 Oct 31 '18 at 23:51
  • Unfortunately the code I'm writing is getting plugged into a larger project, and everything I'm writing is wrapped in a try/except. I realize that hinders the ability to answer the question - sorry about that. perhaps I can make use of @ColbyHunter's suggestion and try using eggs. Thanks for all the responses guys. – DJMcCarthy12 Oct 31 '18 at 23:57

0 Answers0