mgaitan / fortran_magic

An extension for IPython/Jupyter that helps to use Fortran in your interactive session.
BSD 3-Clause "New" or "Revised" License
116 stars 32 forks source link

UnicodeDecodeError when debugging fortran code #20

Open jfb10d opened 7 years ago

jfb10d commented 7 years ago

When I debugged the fortran code in IPython notebook, the following error occurred:

UnicodeDecodeError Traceback (most recent call last)

in () ----> 1 get_ipython().run_cell_magic(u'fortran', u'-vvv', u'`my fortran module`') /Users/xxx/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell) 2291 magic_arg_s = self.var_expand(line, stack_depth) 2292 with self.builtin_trap: -> 2293 result = fn(magic_arg_s, cell) 2294 return result 2295 in fortran(self, line, cell) /Users/xxx/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in (f, *a, **k) 191 # but it's overkill for just that one bit of state. 192 def magic_deco(arg): --> 193 call = lambda f, *a, **k: f(*a, **k) 194 195 if callable(arg): /Users/xxx/anaconda/lib/python2.7/site-packages/fortranmagic.pyc in fortran(self, line, cell) 375 376 res = self._run_f2py(f2py_args + ['-m', module_name, '-c', f90_file], --> 377 verbosity=args.verbosity) 378 if res != 0: 379 raise RuntimeError("f2py failed, see output") /Users/xxx/anaconda/lib/python2.7/site-packages/fortranmagic.pyc in _run_f2py(self, argv, show_captured, verbosity) 202 if show_captured or verbosity > 2: 203 if out: --> 204 sys.stdout.write(out.decode()) 205 sys.stdout.flush() 206 captured() UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 6133: ordinal not in range(128) If I use option **-v** or **-vv**, it says the fortran objects are ready to use. But when I call the subroutine, it says 'name xxx not defined', which suggests the fortran module is not compile correctly? I'm not sure what's going on??