Category Archives: python

LookupError: unknown encoding: utf-8 in py2exe

Solutions:
Solution 1. In building the package in the console you include a package using --packages arg.

C:\myapp\>C:\Python26\python.exe setup.py py2exe --packages encodings

Solution 2. You can also include the package in your setup file

from distutils.core import setup
import py2exe
import sys

sys.argv.append("-p encodings")

and then run
C:\myapp\>C:\Python26\python.exe setup.py py2exe

Sample code to redirect console output to gui app in python

This is a simple python code that integrates console output to GUI.
Continue reading “Sample code to redirect console output to gui app in python” »

Two easy ways to create cronjobs log reports

In creating a log report you can test if your cron job is running or not. There are two ways to create a log report, either you do it in your main script (in this example, MyScript.py) or directly in your cron job setup using crontab.
Continue reading “Two easy ways to create cronjobs log reports” »

pypdf PdfFileReader access denied while trying to rename/remove file

I was trying to extract pages that contains a specific world on my file mypdf.pdf. Things went well until i’m almost done and try to rename mypdf.pdf to mypdf_orig.pdf:
Continue reading “pypdf PdfFileReader access denied while trying to rename/remove file” »