pieqq/PyGeoIpMap

No display

Opened this issue · 2 comments

I am trying to run this on a linux server that doesn't have a real display. I get the following error when trying to build the map.

_tkinter.TclError: no display name and no $DISPLAY environment variable

Is there any way to run this without a display?

The script doesn't use the tk libraries, but Matplotlib does, and it looks like Matplotlib tries to use an X server no matter what it does (even when not exporting anything to any display).

I found this answer on stack overflow that could be interesting.

Please try to replace:

import csv
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

with

import csv
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

and launch the script again. If it works, I will push this change.

That did the trick. Thanks! bows