Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python quits and ka-lite server is killed when trying to download videos (on Macbook) #3593

Closed
arnoan opened this issue May 3, 2015 · 10 comments
Assignees

Comments

@arnoan
Copy link
Contributor

arnoan commented May 3, 2015

Branch: master (0.13.1)
Expected Behavior: Upon clicking the download button in the video management section the download should start
Current Behavior: Upon clicking the download button the download seems to start in the background (page is updated) but Python quits immediately with an error message and shuts down the ka-lite server
Steps to reproduce: Every time I try to download videos via the user interface a ka-lite server running on the Macbook Air 2011. Newest version of ka-lite and python are being used.

screenshot 2015-05-03 19 29 18

@EdDixon
Copy link
Contributor

EdDixon commented May 3, 2015

This is unexpected! Which version of OS X are you running? Just checked here Python 2.7.9 and KA-Lite13.1 branch downloading videos no problem?

@jamalex
Copy link
Member

jamalex commented May 4, 2015

Sounds like this is a revival of this issue:
#2643
which was caused by the version of Python that ships with OSX.

Installing a clean version of Python 2.7.9 from the Python website directly should fix this.

@MCGallaspy, I think we used to highlight this fact more saliently on the install guide. The current version only asks them to verify that they have 2.6 or 2.7 installed, not that the built-in version of Python blows up on video download. Could you add some sort of "Warning" box on this page?
https://learningequality.org/docs/installguide/install_mac.html

@EdDixon
Copy link
Contributor

EdDixon commented May 4, 2015

@jamalex @aronasorman In a prior issue #3592 report and this one there was mention that the latest python was being used. Knowing we are testing a MAC installer this week I want to be absolutely sure our 13.1 is good here in order to revert back to it in troubleshooting issues with the installer we may have. So completely uninstalled 13.x and reinstalled git 0.13.x on Yosemite 10.10.3 with python version 2.7.9 with no issues either in the installation in device registration to hub, or downloading of videos.

@arnoan
Copy link
Contributor Author

arnoan commented May 4, 2015

@EdDixon @jamalex
Running a 2011 Macbook Air with Yosemite 10.3.3.
I just checked and I am indeed still running an outdated version of python on my mac. (2.7.6) Or rather I have multiple versions of python installed but the old version is still being used for some reason. Python installations on mac don't seem to automatically replace the old version. Looking into this right now and will will get back in a few minutes.

Either way it would be good to state this explicitly in the documentations as most Mac's would be running with an outdated version of python 2.7 and the installation & replacement process for new versions is not straight forward.

@arnoan
Copy link
Contributor Author

arnoan commented May 4, 2015

Managed to fully update python following a tutorial. (http://wolfpaulus.com/jounal/mac/installing_python_osx/)

Now Python 2.7.9 is running but I must have messed up something in the process as kalite does not respond in a meaningful way anymore.
Mawens-MacBook-Air:ka-lite user$ python -V
Python 2.7.9
Mawens-MacBook-Air:ka-lite user$ ./bin/kalite start
Traceback (most recent call last):
File "/Users/user/ka-lite/kalitectl.py", line 504, in
args=arguments['DJANGO_OPTIONS']
File "/Users/user/ka-lite/kalitectl.py", line 353, in start
'--pid-file={0000:s}'.format(PID_FILE_JOB_SCHEDULER)
File "/Users/user/ka-lite/kalitectl.py", line 288, in manage
get_commands()
File "/Users/user/ka-lite/python-packages/django/core/management/init.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/Users/user/ka-lite/python-packages/django/conf/init.py", line 53, in getattr
self._setup(name)
File "/Users/user/ka-lite/python-packages/django/conf/init.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/Users/user/ka-lite/python-packages/django/conf/init.py", line 132, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Users/user/ka-lite/python-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/Users/user/ka-lite/kalite/settings.py", line 21, in
from local_settings import *
File "/Users/user/ka-lite/kalite/local_settings.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file /Users/user/ka-lite/kalite/local_settings.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Mawens-MacBook-Air:ka-lite user$

The resulting error here is clearly my wrongdoing.

If - through whichever method - Python is updated successfully to 2.7.9 I'm confident everything would be functioning as expected.

@MCGallaspy
Copy link
Contributor

I'll update the docs to accurately indicate which version of Python is necessary. But the last error you reported @arnoan:

SyntaxError: Non-ASCII character '\xe2' in file /Users/user/ka-lite/kalite/local_settings.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Is because the python interpreter encountered a character it didn't like in local_settings.py, which is not a file created automatically during installation. Did you create this file yourself? The link from the error describes how you can define the encoding of the file. I think if you add this line to the top of your file, it should work:

# -*- coding: utf-8 -*-

@arnoan
Copy link
Contributor Author

arnoan commented May 4, 2015

@MCGallaspy
Thank you. Just FYI: Yep, I added the local_settings.py myself to point it to the course material location. It just contains an absolute path as advised in the manual. CONTENT_ROOT="/Volumes/StorEDGE/ka_content/“

It didn't have a problem parsing it before I just tried to upgrade my Python to the newest version so the error should disappear once I have Python properly up and running again. So far I could not yet figure out what's wrong - updates of Python are a real mess on MAC! - but that's just a matter of time.

So you might want to add a line: "Caution: Updating Python on MAC is not straight forward. Attempt only if you are familiar with what you are doing." as it involves quite a bit of playing around with sudo rights.

@MCGallaspy
Copy link
Contributor

It's possible your editor is automatically inserting unicode characters. In fact, looking carefully I suspect the trailing quote is the culprit here! vs. "

@arnoan
Copy link
Contributor Author

arnoan commented May 4, 2015

@MCGallaspy
You're my hero for today! I was still fiddling around with Python trying to figure out what's possibly wrong. In the end simply replacing the trailing quote with the proper version solved the issue now.

With Python 2.7.9 installed and the local_settings.py fixed the downloads are working as expected now. So this issue can be closed. Thanks for the support!

@MCGallaspy
Copy link
Contributor

Once you've been burned by encoding issues once, it sticks with you. ;)

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants