Question
I cant seem to figure out why this is not working when I run in Anaconda. When I run in terminal it is fine, but
I cant seem to figure out why this is not working when I run in Anaconda. When I run in terminal it is fine, but does anyone know why these errors pop up? Is it because I can only run this code in termianl?
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Project :: R00000000
test.py -i
Traceback (most recent call last):
File "/var/folders/mj/gr1bqy890db4h34g5w54yxvm0000gn/T/ipykernel_16878/3909994244.py", line 12, in
opts, args = getopt.getopt(args,"hi:o:p",["infile=","outfile="])
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/getopt.py", line 95, in getopt
opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/getopt.py", line 195, in do_shorts
if short_has_arg(opt, shortopts):
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/getopt.py", line 211, in short_has_arg
raise GetoptError(_('option -%s not recognized') % opt, opt)
getopt.GetoptError: option -f not recognized
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3444, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/var/folders/mj/gr1bqy890db4h34g5w54yxvm0000gn/T/ipykernel_16878/3909994244.py", line 15, in
sys.exit(2)
SystemExit: 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py", line 1101, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py", line 248, in wrapped
return f(*args, **kwargs)
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py", line 281, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "/Users/landonhassin/opt/anaconda3/lib/python3.9/inspect.py", line 1541, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
AttributeError: 'tuple' object has no attribute 'tb_frame'
---------------------------------------------------------------------------
GetoptError Traceback (most recent call last)
/var/folders/mj/gr1bqy890db4h34g5w54yxvm0000gn/T/ipykernel_16878/3909994244.py in
11 try:
---> 12 opts, args = getopt.getopt(args,"hi:o:p",["infile=","outfile="])
13 except getopt.GetoptError:
~/opt/anaconda3/lib/python3.9/getopt.py in getopt(args, shortopts, longopts)
94 else:
---> 95 opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
96
~/opt/anaconda3/lib/python3.9/getopt.py in do_shorts(opts, optstring, shortopts, args)
194 opt, optstring = optstring[0], optstring[1:]
--> 195 if short_has_arg(opt, shortopts):
196 if optstring == '':
~/opt/anaconda3/lib/python3.9/getopt.py in short_has_arg(opt, shortopts)
210 return shortopts.startswith(':', i+1)
--> 211 raise GetoptError(_('option -%s not recognized') % opt, opt)
212
GetoptError: option -f not recognized
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
[... skipping hidden 1 frame]
/var/folders/mj/gr1bqy890db4h34g5w54yxvm0000gn/T/ipykernel_16878/3909994244.py in
14 print ('test.py -i
---> 15 sys.exit(2)
16
SystemExit: 2
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
[... skipping hidden 1 frame]
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
2055 stb = ['An exception has occurred, use %tb to see '
2056 'the full traceback.\n']
-> 2057 stb.extend(self.InteractiveTB.get_exception_only(etype,
2058 value))
2059 else:
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in get_exception_only(self, etype, value)
752 value : exception value
753 """
--> 754 return ListTB.structured_traceback(self, etype, value)
755
756 def show_exception_only(self, etype, evalue):
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, context)
627 chained_exceptions_tb_offset = 0
628 out_list = (
--> 629 self.structured_traceback(
630 etype, evalue, (etb, chained_exc_ids),
631 chained_exceptions_tb_offset, context)
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1365 else:
1366 self.tb = tb
-> 1367 return FormattedTB.structured_traceback(
1368 self, etype, value, tb, tb_offset, number_of_lines_of_context)
1369
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1265 if mode in self.verbose_modes:
1266 # Verbose modes need a full traceback
-> 1267 return VerboseTB.structured_traceback(
1268 self, etype, value, tb, tb_offset, number_of_lines_of_context
1269 )
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
1122 """Return a nice text document describing the traceback."""
1123
-> 1124 formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
1125 tb_offset)
1126
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
1080
1081
-> 1082 last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
1083
1084 frames = self.format_records(records, last_unique, recursion_repeat)
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/ultratb.py in find_recursion(etype, value, records)
380 # first frame (from in to out) that looks different.
381 if not is_recursion_error(etype, value, records):
--> 382 return len(records), 0
383
384 # Select filename, lineno, func_name to track frames with
TypeError: object of type 'NoneType' has no len()
[ ]:
SerialTester.ipynb
Serial.ipynb
Half.ipynb
TestOutput.ipynb
Untitled40.ipynb
input.txt
output.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started