Follow me
-
Recent Posts
calendar
December 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Tag Archives: python
ipython autocompletion does not work
With IPython version 7.12.0 and python 3.7.3, Ipython crashes when I wanted to autocomplete a file or a module import. This fixed my problem: pip install pyreadline An the jedi package was set to 0.18.0 but this seems to cause … Continue reading
How to use subprocess with PIPEs
In Python, the subprocess module allows you to execute linux/unix commands directly from Python. The official Python documentation is very useful would you need to go further. Yet it may be a bit scary for newbies. Syntax may also change … Continue reading
How to get pypi statistics about package download
A while ago, I designed pypiview, a Python package used to fetch the number of downloads for a package hosted on pypi website. It used to work decently but according to pypi itself the values stored are not reliable and … Continue reading
Difference between __repr__ and __str__ in Python
When implementing a class in Python, you usually implement the __repr__ and __str__ methods. __str__ should print a readable message __repr__ should print a message that is unambigous (e.g. name of an identifier, class name, etc). You can see __str__ … Continue reading
pytest-cov collects no data on Travis
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 warning: … Continue reading
Installing Python2.6 in a virtual environment
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 a … Continue reading
Installation of Python 2.6 error fixed
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: ./configure –prefix=<PATH_WHERE_TO_INSTALL> make./configure –prefix=<PATH_WHERE_TO_INSTALL> make If you are lucky, everything is … Continue reading
Python function chmod to change permission
I naively tried the function chmod from the standard python module called os to change the permission of a file: os.chmod(filename, 644)os.chmod(filename, 644) Checking in the unix command line (ls -l), I got an unexpected result: –w—-r-T.–w—-r-T. I expected indeed … Continue reading
Python : How to flush output of print
Using the sys module, just type: import sys sys.stdout.flush()import sys sys.stdout.flush()
python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
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 a … Continue reading