All posts filed under: Python

Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability.

PIL: ord() expected a character, but string of length 0 found (SOLVED)

Leave a comment
django / Howtos / Python
PIL error

Using Django, and easy_thumbnails coupled with Pillow specifically I’m stumbled upon this error in PIL.ImageFile on PIL/ ord() expected a character, but string of length 0 found This python error was so frequent I’ve done some research, coming up with nothing. I’ve checked current Pillow version with: Getting: Pillow==3.0.0 Then I’ve upgraded the Pillow package with this: The sofware was updated to the very last version (5.0.0) without any issue on easy_thumbnails backend or frontend. […]

Why you should not use Drupal anymore

Leave a comment
Coding / django / Drupal / Python

I’ve started using Drupal on 2007. For about 9 years I visits almost on daily basis, I released a module, I suggested some patches, participated to local events and so on. I’ve started working on Drupal with Drupal 5 and I ended on Drupal 7 with a long time on Drupal 6. In the meantime, Acquia was created to support Drupal development and make some money from the project and for the project in […]

A new language for Social Media managers on Twitter

Leave a comment
Coding / Howtos / Python
A screen from JournaKit Followship .ows

Last months I looked for a tool to shape my community on Twitter to follow interesting profiles and to increase my followers. I had bad experiences using integration from third party (app) so I wanted this tool to be able to create my own app on Twitter without 3rd party involvment for better security and privacy. Since I wanted real new followers and I don’t want to violate Twitter policies I looked for a tool […]

Spellcheck web page by address

Leave a comment
Howtos / Python

Looking for error in web pages can be very boring. I’ve tried some online tools but they seems too old, unsatisfying or premium only so I go to a 3 days programming marathon and I put online a brand new tool to do the job I need. Go to Spellcheck This! and paste the URL address of the page you want to check and get the page checked for Deutsch, US English, Español, Français and […]

Linux: MySQLdb on virtualenv with –no-site-packages

comment 1
Howtos / Python / System Administration

In the past it was difficult to get MySQL working on virtualenv without using system packages. Now you can have a real separated environment with simple steps: Follow this guide to install virtualenv using this command: This command will install a new virtualenv inside a new directory myproject created by the command itself. Activate virtualenv: Upgrade setuptools You can now install MySQLdb, inside the package MySQL-python: Now do a simple test trying to connect to […]

Python: MySQLdb on Windows virtualenv (w. figures)

comment 1
Howtos / Python

If you have a virtualenv on Windows and you want to add MySQLdb support via mysql-python, read this before spending hours of your life to figure why it doesn’t and it will never work. 1) Install MySQL for Python selecting the same Python version of the virtualenv 2) From site-packages directory above, copy the selected files: 3) (optional) On PyCharm, look for virtualenv site-packages inside the path marked with the arrow: 4) Open your virtualenv […]

Memory Error on pip install (SOLVED)

comments 6

Memory Error when using pip install on Python can emerge both from command line or from a IDE like PyCharm, usually when the package size is big. When you try to install a python package with pip install packagename but it fails due to a Memory Error, you can fix it in this way: Go to your console Optional: if your application is into a a virtual environment activate it The package will now be […]

Reduce Time to the First Byte – TTFB on web applications

Leave a comment
Coding / django / Python
A typical web application

How to speed up the time to the first byte and what are the causes of a long TTFB? Main causes are network and server-side and I will focus on server-side causes. I’m not covering any CMS here but you can try to apply some of these techniques starting from how to interpret the browser Timing. Get reliable timing Take a website with cache enabled: at the 9th visit on a page you can be […]

From Drupal to Django: how to migrate contents

Leave a comment
Coding / django / Drupal / Howtos / Python

In a recent article I explain the motivations for an upgrade from a no longer maintained Drupal 6 installation to Django 1.8. I will now cover more in detail the migration techniques adopted in the upgrade and I’ll deepen the models and the relationships. Structure If you’re a drupaler, you’re familiar with the node/NID/edit and the node/add/TYPE pages: Here we have two visible fields: Title and Body. One is an input type text and the other a […]