Tag Archives: python

pytest-cov collects no data on Travis

Tweet I recently switched from nosetests to pytest and pytest-cov for one of my Python project (http://easydev-python.readthedocs.io). Locally, everything seemed to work fine and once on Travis, all tests passed as expected. Yet, before the coverage report, I noticed this … Continue reading

Posted in Python | Tagged , , | 2 Comments

Installing Python2.6 in a virtual environment

Tweet First, install python2.6 executable. see previous post if you have issues when compiling (gcc not found). Make sure you have installed python-dev with apt-get or yum. Then, following the instructions on the same topic but for Python 3 in … Continue reading

Posted in Python, Software development | Tagged , | 2 Comments

Installation of Python 2.6 error fixed

Tweet I wanted to install python2.6 in a virtual environment. The first step was to compile python 2.6 executable from the source code. Once the source are extracted, just type:

If you are lucky, everything is smooth and you … Continue reading

Posted in Python | Tagged , | 4 Comments

New software on pypi: pypiview

Tweet I’ve moved an old code into a new Pypi package and took the opportunity to play around with the badges. The new package called pypiview is now available on pypi. It allows one to easily look at the number … Continue reading

Posted in Software development | Tagged , , | Leave a comment

Python function chmod to change permission

Tweet I naively tried the function chmod from the standard python module called os to change the permission of a file:

Checking in the unix command line (ls -l), I got an unexpected result:

I expected indeed a … Continue reading

Posted in Python | Tagged | 2 Comments

Python : How to flush output of print

Tweet Using the sys module, just type:

Posted in Python | Tagged | Leave a comment

python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)

Tweet Even though Python has a great documentation, once in a while you get stuck on a single problem more than expected. It happenned to me today with the argparse module, which I thought I knew enough to quickly code … Continue reading

Posted in Python | Tagged | 14 Comments

Starting to use Python Pandas library

Tweet Pandas is brilliant. If you are looking to manipulate data in Python, use it. I am refactoring most of my codes with this library. It provides many useful data structures to manipulate data in 2, 3, 4 dimensions and … Continue reading

Posted in Python | Tagged , | Leave a comment

Line starting ‘ …’ is malformed! error

Tweet Playing with a Python wrapper of an R package, I suddenly got this error after a trivial change of the code:

Wondering for a couple of minutes where it could come from without success, I google the error … Continue reading

Posted in R | Tagged , , | Leave a comment

Profiling Python with valgrind

Tweet 1. Under Linux, install valgrind as follows (Fedora):

and pyprof2calltree:

2. create a Python script (let us call it run.py) 3. Create the file containing the profile information using valgrind/callgrind

4. Visualisation

Alternatively, for visualisation, … Continue reading

Posted in Python | Tagged , | Leave a comment