Matplotlib tkinter error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Matplotlib tkinter error

Pooja
Hi,

I have been working on a piece of code and suddenly getting these errors:
/Users/poojabhalode/.bash_profile: line 1: .bashrc: No such file or directory
[[ 2 -1  0]
 [-1  2 -1]
 [ 0 -1  2]]
[[  3.41421356e+00   8.32667268e-17  -6.37995760e-17]
 [  0.00000000e+00   2.00000000e+00   1.35170527e-16]
 [  0.00000000e+00   0.00000000e+00   5.85786438e-01]]
8.32667268469e-17
8.32667268469e-17
-6.37995760397e-17
0.0
1.35170526715e-16
0.0
0.0
[[ 3.41421356  0.          0.        ]
 [ 0.          2.          0.        ]
 [ 0.          0.          0.58578644]]
Traceback (most recent call last):
  File "/Users/poojabhalode/Google Drive/PYTHON/files/1sttest/May17.py", line 7, in <module>
    import matplotlib
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 947, in <module>
    rcParams = rc_params()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 856, in rc_params
    fname = matplotlib_fname()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 726, in matplotlib_fname
    configdir = _get_configdir()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 597, in _get_configdir
    return _get_config_or_cache_dir(_get_xdg_config_dir())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 566, in _get_config_or_cache_dir
    if not _is_writable_dir(p):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 228, in _is_writable_dir
    t = tempfile.TemporaryFile(dir=p)
AttributeError: 'module' object has no attribute 'TemporaryFile'
[Finished in 0.2s with exit code 1]
[shell_cmd: python -u "/Users/poojabhalode/Google Drive/PYTHON/files/1sttest/May17.py"]
[dir: /Users/poojabhalode/Google Drive/PYTHON/files/1sttest]
[path: /usr/bin:/bin:/usr/sbin:/sbin]


My code gives errors at the import statement itself:

Code::
import matplotlib
ERROR indicated here.
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure

Can someone please let me know what is going wrong with this?
Thank you. I would really appreciate it.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Matplotlib tkinter error

tcaswell
Do you have a file called `tempfile.py` in the directory you are running the script from?

The issue is that the module `tempfile` (which should be coming from the standard library) is reporting that it does not have an expected member (TemporaryFile).   If you are shadowing that module with a local file you will see exceptions like this.  The other option is that you python installation is broken.

Tom

On Sat, Aug 5, 2017 at 12:36 PM Pooja <[hidden email]> wrote:
Hi,

I have been working on a piece of code and suddenly getting these errors:
/Users/poojabhalode/.bash_profile: line 1: .bashrc: No such file or
directory
[[ 2 -1  0]
 [-1  2 -1]
 [ 0 -1  2]]
[[  3.41421356e+00   8.32667268e-17  -6.37995760e-17]
 [  0.00000000e+00   2.00000000e+00   1.35170527e-16]
 [  0.00000000e+00   0.00000000e+00   5.85786438e-01]]
8.32667268469e-17
8.32667268469e-17
-6.37995760397e-17
0.0
1.35170526715e-16
0.0
0.0
[[ 3.41421356  0.          0.        ]
 [ 0.          2.          0.        ]
 [ 0.          0.          0.58578644]]
Traceback (most recent call last):
  File "/Users/poojabhalode/Google Drive/PYTHON/files/1sttest/May17.py",
line 7, in <module>
    import matplotlib
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 947, in <module>
    rcParams = rc_params()
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 856, in rc_params
    fname = matplotlib_fname()
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 726, in matplotlib_fname
    configdir = _get_configdir()
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 597, in _get_configdir
    return _get_config_or_cache_dir(_get_xdg_config_dir())
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 566, in _get_config_or_cache_dir
    if not _is_writable_dir(p):
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py",
line 228, in _is_writable_dir
    t = tempfile.TemporaryFile(dir=p)
AttributeError: 'module' object has no attribute 'TemporaryFile'
[Finished in 0.2s with exit code 1]
[shell_cmd: python -u "/Users/poojabhalode/Google
Drive/PYTHON/files/1sttest/May17.py"]
[dir: /Users/poojabhalode/Google Drive/PYTHON/files/1sttest]
[path: /usr/bin:/bin:/usr/sbin:/sbin]


My code gives errors at the import statement itself:

Code::
import matplotlib
ERROR indicated here.
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
from matplotlib.figure import Figure

Can someone please let me know what is going wrong with this?
Thank you. I would really appreciate it.

Thanks!




--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-tkinter-error-tp48051.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users