0

I've made a program with Twython as the framework for accessing the Twitter Api. It works fine when ran as a python program, but after compiling it with py2exe, pyinstaller, and cxfreeze, it returns the same error:

  File "twython\endpoints.pyc", line 169, in search
  File "twython\api.pyc", line 263, in get
  File "twython\api.pyc", line 257, in request
  File "twython\api.pyc", line 165, in _request
  twython.exceptions.TwythonError: [Errno 2] No such file or directory

I've made sure to include twython.exceptions when compiling. I cannot seem to get this thing to work properly as an executable. I've attempted on my computer and a fresh VM so there shouldn't be any installation issues. Any ideas?

  • Not sure what your problem is, but if you look at the `twython` code, you see that your error is in the request, `try: response = func(url, **requests_args) except requests.RequestException as e: raise TwythonError(str(e))`, the `raise` at line 165. Maybe it gives you a clue. How are you composing the url of the request? (Looks like it is not really a url). There's some configuration in your python program that is is not in the py2exe version? Hope it helps. – lrnzcig May 06 '15 at 09:55
  • @lrnzcig it seems like http://pastebin.com/rhJdrQ3d is where url is defined at. Line 253. It seems like everything should be self contained and not need any thing else. It's very strange. – Justin Poiroux May 06 '15 at 21:53
  • Hi. You are right, the `url` is self contained in the `twython` code. This is what I would do: clone `twython` from `github`, add a few traces in `api.py`, and add the modified `twython` package to your exe. Maybe you can get a hint of what's wrong. Hope it helps. – lrnzcig May 07 '15 at 09:27
  • @JustinPoiroux What parameters are you passing to the twython `search` method? Can you display a mock of your twython.search() ? Also, are all of the dependencies loading in properly? You can check out [DependencyWalker](http://www.dependencywalker.com/) from what I have seen for unrelated SO py2exe issue debugging. – mbeacom May 13 '15 at 04:11
  • http://pastebin.com/1wLGXhb5 Here is a sample code that also raises the error when compiled to exe. Nothing changes from the single script to the compiled version in terms of content. I've used three different compilation methods so I feel as though the dependencies should be all packaged correctly. But @mbeacom, I will give it a try. I'll also try adding traces. – Justin Poiroux May 13 '15 at 04:32

0 Answers0