Sometimes we need to work with some graphical and GIS data in very specific format. Here I will show how to work with shp data foramt in Python.

Here is a library pyshp. Install it

Then open some file using pyshp

We can list points in shp data

Result

WE can visualize points using matplotlib library. That’s very simple. Import matplotlib.pyplot

and visualize point

Result

Sometimes unexpected and strange problems arise when you start using new operating system and know very little about it. Here I will tell about tricky problem I met when using CentOS.

When you click icon Start in the bottom left corner you can observe Lock screen button - first one with lock icon

The problem was that the button stop working — just no action at all.

This was caused by creating a symbolic link python3 to specific version of Python. Apperantly desktop shell of CentOS using Python for some reason.

To solve the problem simply change the symbolic link python3 to previous version of Python

and reboot system.

SQLAlchemy is quite popular ORM in Python commonly used with Flask applications. SQLAlchemy has even a special version Flask-SQLAlchemy.

There is many tutorials on using SQLAlchemy in context of Flask application. However sometimes we need only to verify whether our data model created using SQLAlchemy ORM works as it’s expected…

When working on Flask project we often need a functionality to send emails to users. For instance, when registering user we would like to verify his email address or if a user forgot his password and we need to allow him to reset password.

There is a library Flask-Mail which…

Cross-domain requests are not allowed on default due to security reasons. If client from another domain and/or port that the server located at will send any request to REST API server browser will block it.

CORS request should be enabled on server. To allow client send CORS requests to our…

During working on a Python project some .pyc files in __pycache__ directories appeared. Those files are just compiled version of code already in repo. It’s junk and it’s a good practice to get rid of it.

To remove it run command:

And add .gitignore file from here. Next time you commit changes git will automatically remove these files as well as another types of files listed in .gitignore file.

You can easily test your REST API using Flask client. To access Flask test client use method test_client() on your app module:

Flask test client allows to work with it through context manager using operator with.

Send GET query

If you use Windows Linux Subsystem (WLS) under Windows you can meet such a situation when file .bashrc is not sourced when loading WLS terminal.

Thus terminal in WLS is not colored and aliases, env variables are not available.

That could be caused by rewriting instructions in ~/.bash_profile file.

To fix it edit file ~/.bash_profile and add following lines:

Solution is found here.

Privalov Vladimir

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store