Showing results for 
Search instead for 
Did you mean: 
New Member

How load image in python on online report



I am want to add a background image to a scatter plot and the only way I could think of is doing it in python, here is the python code:


# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset = pandas.DataFrame(x, z)
# dataset = dataset.drop_duplicates()

# Paste or type your script code here:
import numpy as np
import matplotlib.pyplot as plt

ax = plt.gca()
image_path = '<Image_URL>'
image = plt.imread(image_path)
ax.imshow(image, extent=[-150, 157, -150, 145])

posx = dataset.x
posz = dataset.z
plt.scatter(posx, posz, color='red', s=0.8)


My image I want to use is in an Azure blob storage and I create a shared access signature to access it, it works fine on the desktop app but when I publish it online I get this error:

Script Runtime Error

File "C:\Python\Lib\http\", line 1298, in _send_request

self.endheaders(body, encode_chunked=encode_chunked)

File "C:\Python\Lib\http\", line 1247, in endheaders

self._send_output(message_body, encode_chunked=encode_chunked)

File "C:\Python\Lib\http\", line 1026, in _send_output


File "C:\Python\Lib\http\", line 966, in send


File "C:\Python\Lib\http\", line 1414, in connect


File "C:\Python\Lib\http\", line 938, in connect

(,self.port), self.timeout, self.source_address)

File "C:\Python\Lib\", line 707, in create_connection

for res in getaddrinfo(host, port, 0, SOCK_STREAM):

File "C:\Python\Lib\", line 752, in getaddrinfo

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

socket.gaierror: [Errno 11001] getaddrinfo failed


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "C:\Script\", line 32, in <module>

image = plt.imread(image_path)

File "C:\Python\lib\site-packages\matplotlib\", line 2061, in imread

return matplotlib.image.imread(fname, format)

File "C:\Python\lib\site-packages\matplotlib\", line 1472, in imread

fd = BytesIO(request.urlopen(fname).read())

File "C:\Python\Lib\urllib\", line 222, in urlopen

return, data, timeout)

File "C:\Python\Lib\urllib\", line 525, in open

response = self._open(req, data)

File "C:\Python\Lib\urllib\", line 543, in _open

'_open', req)

File "C:\Python\Lib\urllib\", line 503, in _call_chain

result = func(*args)

File "C:\Python\Lib\urllib\", line 1362, in https_open

context=self._context, check_hostname=self._check_hostname)

File "C:\Python\Lib\urllib\", line 1321, in do_open

raise URLError(err)

urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

Please try again later or contact support. If you contact support, please provide these details.
Activity ID: 4e7b3908-0bf8-4531-add8-f6db64126774
Request ID: a3eb5f20-a82f-d992-6e98-3a31bc514bd3
Correlation ID: 863a9f65-6020-cdf3-448d-652bdd0d974b
Time: Tue Aug 04 2020 18:03:25 GMT+0100 (British Summer Time)
Service version: 13.0.13960.55
Client version: 2007.3.02181-train
Cluster URI:

Community Support
Community Support

Re: How load image in python on online report

Hi @ZisoT ,


Please check if your personal gateway is working and your credential is correct.




Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors