Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Permission error with matplotlib
-
When i run a script beginning by
Import matplotlib.pyplot as plt
I receive the error :
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/4BA6E19A-FF26-4669-AB09-A61F7C038568/File Provider Storage/LocalDocuments/Python/tps_reduit.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/var/containers/Bundle/Application/4B63730D-AAC6-41D0-84B4-F312A805EE0E/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/init.py", line 1050, in <module>
rcParams = rc_params()
File "/var/containers/Bundle/Application/4B63730D-AAC6-41D0-84B4-F312A805EE0E/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/init.py", line 899, in rc_params
fname = matplotlib_fname()
File "/var/containers/Bundle/Application/4B63730D-AAC6-41D0-84B4-F312A805EE0E/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/init.py", line 750, in matplotlib_fname
fname = os.path.join(os.getcwd(), 'matplotlibrc')
PermissionError: [Errno 1] Operation not permittedWhat should i do ?
-
It looks like you've opened the script in Pythonista from another app. Can you try copying the script into Pythonista, and see if it works then? To do that, tap the "+" (new file) button in Pythonista, select "Import...", then "Files", and then select the script in the file browser.
When you open a file from one app in another app, the file is not copied (if both apps support it). Instead, iOS allows the second app to read the file from the first app, but only that specific file. Other files in the first app are still not readable by the second app. This seems to cause problems with
matplotlib
, which is trying to read a config file from the folder that the script is in, but iOS is blocking it. If you copy/import the script into Pythonista and run it from there, all files in the script folder can be read, and you won't get any permission errors. -
Yes ! It’s Working! Thanks you !