Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

compiling error

+4 votes
asked Dec 23, 2020 by saleem (160 points) 1 flag

Hi,

When i run the code below I get the following error.

from matplotlib import pyplot as plt
def draw_square():
ax = matplotlib.axes(xlim = (0, 6), ylim = (0, 6))
square = matplotlib.Polygon([(1, 1), (5, 1), (5, 5), (1, 5)], closed = True)
ax.add_patch(square)
matplotlib.show()
if __name__ == '__main__':
draw_square()

Here comes the link to shared fil on onlinegdb

https://onlinegdb.com/SJfoXxbTD

Error: 

Traceback (most recent call last):                                                                                      
  File "main.py", line 1, in <module>                                                                                   
    from matplotlib import pyplot as plt                                                                                
  File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 967, in <module>                                   
    rcParams = rc_params()                                                                                              
  File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 876, in rc_params                                  
    fname = matplotlib_fname()                                                                                          
  File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 744, in matplotlib_fname                           
    configdir = _get_configdir()                                                                                        
                  
  File "/usr/lib/python3.4/getpass.py", line 170, in getuser                                                            
    return pwd.getpwuid(os.getuid())[0]                                                                                 
KeyError: 'getpwuid(): uid not found: 14062'                  

what is going wrong.

thanks

regards

1 Answer

0 votes
answered Jan 13 by KKN (340 points)
edited Jan 13 by KKN
Now, I don't know how to use matplotlib, but, I don't think onlinegdb supports showing images in the terminal (or any compiler really).

You may want to download a nice compiler, like visual studio code and you need a bitmap(or an image) (not sure how to do that).

Btw, w3schools.org has a cool matplotlib tutorial, you can look there.

Hope this helped :)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...