Question

I have a script where I'm using fbconsole and twitter. Those scripts run fine on their own.

For the GUI part, I'm trying to use Kivy. Now when I'm importing my script, I'm getting a error ImportError saying there's no module named twitter/fbconsole. What do I do?

I checked the path that is displayed when the kivy app is run. Here's the complete log

botstrapping Kivy @ C:\Users\roy\Desktop\Kivy-1.7.2-w32\
Setting Environment Variables:
#################################
GST_REGISTRY
C:\Users\roy\Desktop\Kivy-1.7.2-w32\gstreamer\registry.bin
---------------
GST_PLUGIN_PATH:
C:\Users\roy\Desktop\Kivy-1.7.2-w32\gstreamer\lib\gstreamer-0.10
---------------
PATH:
C:\Users\roy\Desktop\Kivy-1.7.2-w32\;C:\Users\roy\Desktop\Kivy-1.7.2-w32\Python;
C:\Users\roy\Desktop\Kivy-1.7.2-w32\Python\Scripts;C:\Users\roy\Desktop\Kivy-1.7
.2-w32\gstreamer\bin;C:\Users\roy\Desktop\Kivy-1.7.2-w32\MinGW\bin;C:\Program Fi
les (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Wind
ows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\python27\;C:\Pr
ogram Files (x86)\Java\jdk1.7.0\bin;C:\Python27\Scripts;C:\Users\roy\Desktop\Kiv
y-1.7.2-w32;C:\Program Files (x86)\Google\google_appengine\;C:\Python27\Lib\site
-packages\;
----------------------------------
PYTHONPATH:
C:\Users\roy\Desktop\Kivy-1.7.2-w32\kivy;
----------------------------------
##################################
done bootstraping kivy...have fun!\n
running "python.exe C:\Users\roy\Desktop\CSE310\merging\gui1.py" \n
[INFO              ] Kivy v1.7.2
Purge log fired. Analysing...
Purge finished !
[INFO              ] [Logger      ] Record log in C:\Users\roy\.kivy\logs\kivy_1
3-12-26_25.txt
[INFO              ] [Factory     ] 144 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=
Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout
=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout
=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_pygame, img
_pil, img_gif
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeou
t=3600s
[INFO              ] [Text        ] Provider: pygame
[DEBUG             ] [Cache       ] register <kv.loader> with limit=500, timeout
=60s
[INFO              ] [Loader      ] using a thread pool of 2 workers
[DEBUG             ] [Cache       ] register <textinput.label> with limit=None,
timeout=60.0s
[DEBUG             ] [Cache       ] register <textinput.width> with limit=None,
timeout=60.0s
 Traceback (most recent call last):
   File "C:\Users\roy\Desktop\CSE310\merging\gui1.py", line 9, in <module>
     import twit
   File "C:\Users\roy\Desktop\CSE310\merging\twit.py", line 1, in <module>
     from twitter import *
 ImportError: No module named twitter
Press any key to continue . . .
Was it helpful?

Solution

As you are using kivy's portable bundle for windows, you have to install the libraries in the python installation that's shipped with it. To do so, you just have to start the kivy.bat, and use pip install inside of it, the libraries installed this way will be available for the kivy applications.

The alternative solution, is to install kivy system-wide, with all the required dependencies.

OTHER TIPS

You have to edit PYTHONPATH to include the folders where python can find fbconsole and twitter.

That way import will find them in sys.modules.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top