running kivy-dependent apps from Spyder (or other python editors)

1,205 views
Skip to first unread message

Lau M. Andersen

unread,
Dec 13, 2012, 5:10:31 AM12/13/12
to kivy-...@googlegroups.com
Hello

I was wondering whether it is possible to run py.-files that are dependent on the kivy-app from other editors (Spyder)? Whenever I run the any of the examples from the Kivy-installation-dmg from within Spyder, I get the following error message:

Traceback (most recent call last):
  File "/Applications/Spyder.app/Contents/Resources/site.py", line 120, in <module>
    import sitecustomize
  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 142, in <module>
    os.environ["SPYDER_AR_STATE"].lower() == "true")
  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/monitor.py", line 133, in __init__
    self.i_request.connect( (host, introspection_port) )
  File "socket.pyo", line 224, in meth
    
socket.error: [Errno 60] Operation timed out

I do not expect you to give any Spyder-related answers since I know this is not the forum for it. I'm just interested in whether it is possible to run directly from various python editors, because I find it cumbersome to drag the py.-files to the Kivy-app all the time. I'm using MacOSX by the way.

All the best
Lau

Gabriel Pettier

unread,
Dec 13, 2012, 5:27:32 AM12/13/12
to kivy-...@googlegroups.com

you should have a `make aymlinks` in the installer, if you use it, you can start your apps from command line using the `kivy` command, then i guess you should be able to configure your ide to to that. :)

--
 
 

Gabriel Pettier

unread,
Dec 13, 2012, 5:28:12 AM12/13/12
to kivy-...@googlegroups.com

symlinks*

Thomas Hansen

unread,
Dec 13, 2012, 7:16:58 AM12/13/12
to kivy-...@googlegroups.com
also, if you want kivy available as a regular python module with the normal python interpretor you can do the following.  (This is how I setup my osx laptop to run using just a kivy git repo located at ~/code/kivy

first I create a folder like e.g.:  /usr/local/kivy
I put a script to set up the environmentvariables, which i source in my .profile and copy the lib folder from the python app package (right click -> show package contents on Kivy.app  then follow path:  Contents / Resources / lib)

so i have:
~/code/kivy  (kivy repo)
/usr/local/kivy/env.sh  (sourced in .profile or in bash session, see here: https://gist.github.com/4276003 )
/usr/local/kivy/lib (has all the dylib and site packages etc..)


I suppose if you want to run python directly from an editor, maybe that editor has a way to setup the environment variables like the env.sh script, or you can start it from an environment that sources env.sh




--
 
 

Lau M. Andersen

unread,
Dec 13, 2012, 7:52:43 AM12/13/12
to kivy-...@googlegroups.com
Thanks a lot, Thomas
I managed to import kivy by doing these two things

1: getting the kivy zip file  https://github.com/kivy/kivy
2: put it in my pythonpath

However, I have problem with the event-module now, but I'll try to figure that out.

Best

Lau

Gabriel Pettier

unread,
Dec 13, 2012, 7:58:45 AM12/13/12
to kivy-...@googlegroups.com
You need to compile it, do "make" in the "kivy" directory.
--
 
 

Lau M. Andersen

unread,
Dec 13, 2012, 8:04:38 AM12/13/12
to kivy-...@googlegroups.com
sorry for the beginner's question, but where am I supposed to do that? – Terminal doesn't work (I typed "make force" while being in the kivy library 

Lau M. Andersen

unread,
Dec 13, 2012, 11:28:53 AM12/13/12
to kivy-...@googlegroups.com
Hi again Thomas

I followed your instructions more closely this time and I have created the folders you mentioned. My only problem now is understanding the env.sh file that you linked to. I've managed to source it, so to my best knowledge, I have done all the steps. I still get import errors however. I just sourced the file as you linked to it. Should that work, or am I supposed to provide some variable names of my own?

Best

Lau

On Thursday, December 13, 2012 1:16:58 PM UTC+1, Thomas Hansen wrote:

NathanSibs

unread,
Jan 7, 2014, 6:07:21 PM1/7/14
to kivy-...@googlegroups.com
this isn't the most elegant solution, but I really didn't understand toms fix.

Open up your sitecustomize.py
"/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py"
add the following lines at the top after all the import lines
sys.path.append('/Applications/Kivy.app/Contents/Resources/kivy')
sys.path.append('/Applications/Kivy.app/Contents/Resources/lib')
sys.path.append('/Applications/Kivy.app/Contents/Resources/lib/sitepackages')

only problem is, you can only run your code once or kivy will crash and hang your interpreter. so just restart your interpreter every time you run.
Boo.
Reply all
Reply to author
Forward
0 new messages