ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory
Turns out all you need to do is
sudo apt-get install libjpeg62
You can test this by starting python and doing:
import _imaging
ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory
sudo apt-get install libjpeg62
import _imaging
PROJ=gae_project
mkvirtualenv ${PROJ}
cdvirtualenv
Note that note that "--no-site-packages" and "--distribute" are now the defaults for mkvirtualenv. You don't even need to use "--python=python2.7" on Ubuntu 12.10.GAE=1.7.4
wget -O /tmp/gae.zip http://googleappengine.googlecode.com/files/google_appengine_${GAE}.zip
unzip /tmp/gae.zip
GAE_APP_NAME=dummy mkdir -p gae_app/staticNow create the app.yaml file:
echo """application: ${GAE_APP_NAME}
version: development
runtime: python27
api_version: 1
threadsafe: true
default_expiration: 7d
handlers:
- url: /static
static_dir: static
- url: .*
script: wsgi_app.app
""" > gae_app/app.yaml
echo """import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Please replace me with a decent WSGI App Framework such as Flask')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
""" > gae_app/wsgi_app.py
python ./google_appengine/dev_appserver.py gae_app/
| English: CPU Zilog Z8 (Photo credit: Wikipedia) |
| AMD Athlon™ X2 Dual-Core Processor 6400+ in AM2 package (Photo credit: Wikipedia) |
| example of Python language (Photo credit: Wikipedia) |
PROJ=py27_gae_project
mkvirtualenv ${PROJ}
cdvirtualenv
Note that note that "--no-site-packages" and "--distribute" are now the defaults for mkvirtualenv. You don't even need to use "--python=python2.7" on Ubuntu 12.04.GAE=1.6.5
wget -O /tmp/gae.zip http://googleappengine.googlecode.com/files/google_appengine_${GAE}.zip
unzip /tmp/gae.zip
GAE_APP_NAME=dummy mkdir -p gae_app/staticNow create the app.yaml file:
echo """application: ${GAE_APP_NAME}
version: development
runtime: python27
api_version: 1
threadsafe: true
default_expiration: 7d
handlers:
- url: /static
static_dir: static
- url: .*
script: wsgi_app.app
""" > gae_app/app.yaml
echo """import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Please replace me with a decent WSGI App Framework such as Flask')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
""" > gae_app/wsgi_app.py
python ./google_appengine/dev_appserver.py gae_app/
![]() |
| RDF types for the DBpedia entry for London |
Semantic Web this, Semantic Web that, what actual use is the Semantic Web in the real world? I mean how can you actually use it?
If you haven't heard the term "Semantic Web" over the last couple of years then you must have been in... well somewhere without this interweb they're all talking about.
Basically, by using metadata (see RDF), disparate bits of data floating around the web can be joined up. In otherwords they stop being disparate. Better than that, theoretically you can query the connections between the data and get lots of lovely information back. This last bit is done via SPARQL, and yes, the QL does stand for Query Language.
I say theoretically because in reality it's a bit of a pain. I may be an intelligent agent capable of finding linked bits of data through the web, but how exactly would you do that in python.
It is possible to use rdflib to find information, but it's very long winded. It's much easier to use SPARQLWrapper andin fact in the simple example below, I've used a SPARQLWrapperWrapper to make asking for lots of similarly sourced data, in this case DBPedia, even easier.
To use this try importing the DBpediaEndpoint and feeding it some SPARQL:
Your homework is - How do you identify the resource_uri in the first place?
That's for another evening.
sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update
sudo apt-get install python2.5 python-virtualenv virtualenvwrapper python-pip
export CURRENT=oinkyoinker
mkvirtualenv --no-site-packages --distribute --python python2.5 ${CURRENT}
workon ${CURRENT}
cdvirtualenv
pip install fabric yolk ipython readline
wget -O /tmp/gae.zip http://googleappengine.googlecode.com/files/google_appengine_1.5.5.zip unzip /tmp/gae.zip echo "../../../google_appengine" > lib/python2.5/site-packages/gae.pthand create a simple file server app:
mkdir -p application/static echo """application: oinkyoinker version: 1 runtime: python api_version: 1 default_expiration: "7d" handlers: - url: / static_dir: static """ > application/app.yamland run it:
./google_appengine/dev_appserver.py application/Hope this helped you too.
from flaskext.script import Manager, Server, Shell
def shell_context():
return dict(app=app)
if __name__ == "__main__":
manager.add_command('dev', DevServer())
manager.add_command('test', Test())
manager.add_command('zen', ZenTest())
manager.add_command('shell', Shell(make_context=shell_context))
manager.run()
python manager.py shell >>> app.debug True >>> app.logger<flask.logging.DebugLogger instance at 0x2ee3518>
from flaskext.script import Manager, Server, Shell
from flaskext.zen import Test, ZenTest
import application
app = application.create_app()
manager = Manager(app)
class DevServer(Server):
def handle(self, app, host, port, use_debugger, use_reloader):
try:
from flaskext.lesscss import lesscss
lesscss(app)
except: pass
app.run(host=host,
port=port,
debug=use_debugger,
use_debugger=use_debugger,
use_reloader=use_reloader,
**self.server_options)
def shell_context():
return dict(app=app)
if __name__ == "__main__":
manager.add_command('dev', DevServer())
manager.add_command('test', Test())
manager.add_command('zen', ZenTest())
manager.add_command('shell', Shell(make_context=shell_context))
manager.run()
python manager.py dev python manager.py test python manager.py zen
from flaskext.script import Manager, Server
from flaskext.zen import Test, ZenTest
import application
app = application.create_app()
manager = Manager(app)
class DevServer(Server):
def handle(self, app, host, port, use_debugger, use_reloader):
try:
from flaskext.lesscss import lesscss
lesscss(app)
except: pass
app.run(host=host,
port=port,
debug=use_debugger,
use_debugger=use_debugger,
use_reloader=use_reloader,
**self.server_options)
if __name__ == "__main__":
manager.add_command("dev", DevServer())
manager.add_command('test', Test())
manager.add_command('zen', ZenTest())
manager.run()
sudo apt-get install git python-setuptools sudo easy_install pip sudo pip install virtualenv virtualenvwrapper
export WORKON_HOME=$HOME/Projects export VIRTUALENVWRAPPER_HOOK_DIR=$HOME/.virtualenvs export VIRTUALENVWRAPPER_LOG_DIR=$HOME/.virtualenvs export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages --distribute' source /usr/local/bin/virtualenvwrapper.sh git config --global user.name "Terse Col" git config --global user.email myemail@gmail.com git config --global http.sslVerify false
mkdir $HOME/.virtualenvs source $HOME/.bashrc mkvirtualenv mynewproject cdvirtualenv