python – elasticsearch – root certificate error

elasticsearch – worked in some instances and not in others.

Failed in virtualenv and Pycharm – reason – missing certfi package. certfi was installed globally so when running in global context worked fine but not inside virtualenv.

installing certfi package fixed issue

(https://stackoverflow.com/a/43872382)

Advertisements

python Convert camelCase

Use python str.title() that converts string to TitleCase, then change the first character to lowercase;  if needed ignore characters that are not alphanumeric. Using this to convert header names in a csv file to be used as property names of an object

def to_camel_case(s):
    ret = ''.join(x for x in s.title() if x.isalpha())
    return ret[0].lower() + ret[1:]

Stackoverflow: see posts for other options and any latest info

Python Mac OS X

Things that I had to do for python on Mac OS X. There are amazing resources on the web

http://docs.python-guide.org/en/latest/starting/install/osx/
http://hackercodex.com/guide/python-development-environment-on-mac-osx/

After a long gap got back to it. VirtualEnv makes a lot of sense and virtualenvwrapper makes it even better.  Tried to install virtualenvwrapper, due to various things done on the system something was messedup

http://virtualenvwrapper.readthedocs.org/en/latest/install.html
Error in loading virtualenvwrapper – source virtualenvwrapper.sh gave an error
tried brew install –python. this gave the warning/error that python was found but not linked. After fixing this virtualenvwrapper loaded fine

Fixing python not linked warning/error
brew link –overwrite python
http://stackoverflow.com/questions/13354207/how-to-symlink-python-in-homebrew

Django

run django_admin.py directly not with python; if with python need full path to djano_admin.py