-
Split Camel Case String in Python
Reference: https://stackoverflow.com/a/29920015/1936697
-
Python: Fix getting “about:blank” in Selenium with PhantomJS
Having an issue with selenium when loading some URL with selenium using PhantomJS. When I get the current_url some URL returned “about:blank” instead of the valid URL. After several workarounds, the issue because PhantomJS by default using “SSLv3” and many websites had a bug in SSL migrate to TLS and caused got a blank page. Here is how…
-
Python: Fix “OSError: [Errno 9] Bad file descriptor” in Selenium using PhantomJS
I’m having an issue when closing selenium driver and sometimes the selenium driver failed to quit. Here is how to I solve this issue. Reference: http://stackoverflow.com/a/38493285/1936697
-
Create Python Class On The Fly
I just found a cool trick in python to create a class dynamically on the fly without creating the class definition. The story behind this, I’m using Django in my project and I need to create serializer class dynamically based on user’s input. Here is how I solving my problem by creating serializer class on…
-
Fix “command ‘gcc’ failed with exit status 4” Once Installing lxml
Today I’m installing sentry on my VPS, I’m using ubuntu 14.04 on smallest instance on DigitalOcean. But the installation failed because of sentry depend on lxml and the lxml failed to install through python pip. Here is the error stacktrace. I don’t know what exactly going on with this, but after looking up on stackoverflow. Some…
-
Save Configuration in Python
Python has “ConfigParser” module that allow you read or write configuration to “.ini” file. And here is how to read or write to config file. First of all you need to create “.ini” file, for instance “hello.ini” Read config file: Write config file: Reference: http://stackoverflow.com/a/19078712/1936697
-
Atom for Python Development
Here is atom plugins that I used for my python development, because I’m no longer using PyCharm. 😀 hyperclick: https://atom.io/packages/hyperclick autocomplete-python: https://atom.io/packages/autocomplete-python linter: https://github.com/atom-community/linter linter-flake8: https://github.com/AtomLinter/linter-flake8 For installation plugins above, you can refer to link that I have provided, because the docs pretty straightforward. 😀 Addition, maybe previously you are using sublime text and you are…
-
Fix “openssl/aes.h file not found” on OS X
I got an issue when installing pusher-http-python, python library for https://pusher.com/ on OS X. My problem solved just run this single line in terminal. Reference: https://github.com/pyca/cryptography/issues/2350 http://masnun.com/2015/12/01/fixing-fatal-error-opensslaes-h-file-not-found-on-os-x.html
-
Python Logging Best Practive
Just found good post about logging best practice for our python project. 😀 http://victorlin.me/posts/2012/08/26/good-logging-practice-in-python