Tag Archives: python

Python Script to Detect Corrupt Image Files (.jpg)

Over the xmas period i  found out that most of the files in my documents folder were corrupt.  I didnt want to delete them all so i decided to see if Python could help and sure enough it did.

So i wrote a script below to;

  • find all images in a folder and sub-dir’s
  • open then with a python library and see if the file is corrupt
  • move them to a folder and rename them

Getting started with Python and the Django Framework part 1

So over the christmas holidays ive been keeping myself busy by learning more about the Python language.

Having learnt a few basics i started to try the Django framework which ive seen mentioned quite a lot.  Im reffering to windows mainly in this case see below for more detailed instructions;

Step 1:
Install python from the site below and install the necessary version for your Operating system.

Step 2:
Once you get that installed, verify that python is installed by typing “python” from the windows command prompt;







Step 3:
Install Django framework via command prompt;

pip install django

Step 4:
Create your first project its best to refer to the offical document and tutorials at;

From the offical site;

Creating a project

If this is your first time using Django, you’ll have to take care of some initial setup. Namely, you’ll need to auto-generate some code that establishes a Django project – a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.

From the command line, cd into a directory where you’d like to store your code, then run the following command:

This will create a mysite directory in your current directory. If it didn’t work, see Problems running django-admin.