I'm trying to implement the DeepLab Model into a Tensorflow environment.
This is the github Repository: https://github.com/tensorflow/models/tree/master/research/deeplab
I'm using Python 3.6.8 and the Jupyter Notebook.
Now I'm facing the problem, that I can't run the train.py. I'm getting the AttributeError: dense_prediction_cell_json and I don't understand why.
I've tried to change the code to get the path right into the variable. Everytime the same error. The .json-file is in the right repository.
AttributeError Traceback (most recent call last)
<ipython-input-10-82da774ae9f4> in <module>
2 flags.mark_flag_as_required('train_logdir')
3 flags.mark_flag_as_required('dataset_dir')
----> 4 tf.app.run()
~\Anaconda\Anaconda3\envs\Tensorflow-GPU\lib\site-packages\tensorflow\python\platform\app.py in run(main, argv)
123 # Call the main function, passing through any arguments
124 # to the final program.
--> 125 _sys.exit(main(argv))
126
<ipython-input-9-5ba5cfdf622b> in main(unused_argv)
32 train_tensor, summary_op = _train_deeplab_model(
33 dataset.get_one_shot_iterator(), dataset.num_of_classes,
---> 34 dataset.ignore_label)
35
36 # Soft placement allows placing on CPU ops without GPU implementation.
<ipython-input-8-75f72f4530ec> in _train_deeplab_model(iterator, num_of_classes, ignore_label)
34 ignore_label=ignore_label,
35 scope=scope,
---> 36 reuse_variable=(i != 0))
37 tower_losses.append(loss)
38
<ipython-input-5-a0f1ad776056> in _tower_loss(iterator, num_of_classes, ignore_label, scope, reuse_variable)
14 with tf.variable_scope(
15 tf.get_variable_scope(), reuse=True if reuse_variable else None):
---> 16 _build_deeplab(iterator, {common.OUTPUT_TYPE: num_of_classes}, ignore_label)
17
18 losses = tf.losses.get_losses(scope=scope)
<ipython-input-4-54ae914e10d7> in _build_deeplab(iterator, outputs_to_num_classes, ignore_label)
19 crop_size=[int(sz) for sz in FLAGS.train_crop_size],
20 atrous_rates=FLAGS.atrous_rates,
---> 21 output_stride=FLAGS.output_stride)
22
23 outputs_to_scales_to_logits = model.multi_scale_logits(
~\Anaconda\DeepLab\models\research\deeplab\common.py in __new__(cls, outputs_to_num_classes, crop_size, atrous_rates, output_stride, preprocessed_images_dtype)
190
191 dense_prediction_cell_config = None
--> 192 if FLAGS.dense_prediction_cell_json:
193 with tf.gfile.Open(FLAGS.dense_prediction_cell_json, 'r') as f:
194 dense_prediction_cell_config = json.load(f)
~\Anaconda\Anaconda3\envs\Tensorflow-GPU\lib\site-packages\tensorflow\python\platform\flags.py in __getattr__(self, name)
83 if not wrapped.is_parsed():
84 wrapped(_sys.argv)
---> 85 return wrapped.__getattr__(name)
86
87 def __setattr__(self, name, value):
~\Anaconda\Anaconda3\envs\Tensorflow-GPU\lib\site-packages\absl\flags\_flagvalues.py in __getattr__(self, name)
471 fl = self._flags()
472 if name not in fl:
--> 473 raise AttributeError(name)
474 if name in self.__dict__['__hiddenflags']:
475 raise AttributeError(name)
AttributeError: dense_prediction_cell_json
In the common.py file the flag is defined as:
flags.DEFINE_string(
'dense_prediction_cell_json',
'./core/dense_prediction_cell_branch5_top1_cityscapes.json',
'A JSON file that specifies the dense prediction cell.')
I was trying to import ecoinvent 3.5 cutoff to a project using brightway, with the following:
if 'ecoinvent 3.5 cutoff' not in databases:
ei35cutofflink=r"H:\Data\ecoinvent 3.5_cutoff_lci_ecoSpold02\datasets"
ei35cutoff=SingleOutputEcospold2Importer(ei35cutofflink, 'ecoinvent 3.5 cutoff')
ei35cutoff.apply_strategies()
ei35cutoff.statistics()
ei35cutoff.write_database()
But I got the following error. It looks like the issue is not that related to brightway, but rather multiprocessing or pickle? I don't understand what the error message means.
---------------------------------------------------------------------------
MaybeEncodingError Traceback (most recent call last)
<ipython-input-4-f9acb2bc0c84> in <module>
1 if 'ecoinvent 3.5 cutoff' not in databases:
2 ei35cutofflink=r"H:\Data\ecoinvent 3.5_cutoff_lci_ecoSpold02\datasets"
----> 3 ei35cutoff=SingleOutputEcospold2Importer(ei35cutofflink, 'ecoinvent 3.5 cutoff')
4 ei35cutoff.apply_strategies()
5 ei35cutoff.statistics()
C:\miniconda3_py37\envs\ab\lib\site-packages\bw2io\importers\ecospold2.py in __init__(self, dirpath, db_name, extractor, use_mp, signal)
63 start = time()
64 try:
---> 65 self.data = extractor.extract(dirpath, db_name, use_mp=use_mp)
66 except RuntimeError as e:
67 raise MultiprocessingError('Multiprocessing error; re-run using `use_mp=False`'
C:\miniconda3_py37\envs\ab\lib\site-packages\bw2io\extractors\ecospold2.py in extract(cls, dirpath, db_name, use_mp)
91 ) for x in filelist
92 ]
---> 93 data = [p.get() for p in results]
94 else:
95 pbar = pyprind.ProgBar(len(filelist), title="Extracting ecospold2 files:", monitor=True)
C:\miniconda3_py37\envs\ab\lib\site-packages\bw2io\extractors\ecospold2.py in <listcomp>(.0)
91 ) for x in filelist
92 ]
---> 93 data = [p.get() for p in results]
94 else:
95 pbar = pyprind.ProgBar(len(filelist), title="Extracting ecospold2 files:", monitor=True)
C:\miniconda3_py37\envs\ab\lib\multiprocessing\pool.py in get(self, timeout)
655 return self._value
656 else:
--> 657 raise self._value
658
659 def _set(self, i, obj):
MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x000001D257C55358>'. Reason: 'TypeError("can't pickle lxml.etree._ListErrorLog objects")'```
Use can use use_mp=False to get a sense of what the actual error is (instead of the error not being pickle-able, and this raising a separate errror). In this case I think you have a problem with the data folder, which you can solve by deleting it and downloading or extracting it again.
Hello I am trying to open a .xlsx file with python, my code is really simple it looks as follows:
import openpyxl
wb = openpyxl.load_workbook('prod334.xlsx')
However I am getting an error, I am not sure about the cause of this error since I am just opening the file, I would like to appreciate any suggestion to overcome this failure.
The error that I am getting is the following:
__init__() got an unexpected keyword argument 'vertAlign'
TypeError Traceback (most recent call last)
main.py in <module>()
2
3
----> 4 wb = openpyxl.load_workbook('prod334.xlsx')
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/excel.pyc in load_workbook(filename, use_iterators, keep_vba, guess_types, data_only)
163
164 try:
--> 165 _load_workbook(wb, archive, filename, use_iterators, keep_vba)
166 except KeyError:
167 e = exc_info()[1]
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/excel.pyc in _load_workbook(wb, archive, filename, use_iterators, keep_vba)
210 assert wb.loaded_theme == None, "even though the theme information is missing there is a theme object ?"
211
--> 212 style_properties = read_style_table(archive.read(ARC_STYLE))
213 style_table = style_properties.pop('table')
214 wb.shared_styles = style_properties.pop('list')
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/style.pyc in read_style_table(xml_source)
221 def read_style_table(xml_source):
222 p = SharedStylesParser(xml_source)
--> 223 p.parse()
224 return p.style_prop
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/style.pyc in parse(self)
37 self.parse_color_index()
38 self.style_prop['color_index'] = self.color_index
---> 39 self.font_list = list(self.parse_fonts())
40 self.fill_list = list(self.parse_fills())
41 self.border_list = list(self.parse_borders())
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/style.pyc in parse_fonts(self)
89 if fonts is not None:
90 for node in safe_iterator(fonts, '{%s}font' % SHEET_MAIN_NS):
---> 91 yield self.parse_font(node)
92
93 def parse_font(self, font_node):
/usr/local/lib/anaconda/lib/python2.7/site-packages/openpyxl/reader/style.pyc in parse_font(self, font_node)
105 if color is not None:
106 font['color'] = Color(**dict(color.items()))
--> 107 return Font(**font)
108
109 def parse_fills(self):
TypeError: __init__() got an unexpected keyword argument 'vertAlign'
I'm trying to reproduce the result of the example file provided by Prof. Zhao using Enthought Canopy:
http://www.shengdongzhao.com/shen_blog/how-to-automatically-create-powerpoint-slides-using-python/
I seem to be having the same problem that others are having (and seem to still be having) which you can see in the comments below the linked blog post. I realize prof. Zhao mentions that the error could be due to the environment not being set correctly. I thought it might have something to do with environment variables not being pointed to correctly. I tried the the first answer at the following but it seems like it prevents canopy from even opening (doing something wrong I am)
How to add to the pythonpath in windows 7?
So what I'm left doing is: I open his scripts in Canopy and then I run MSO.py and then MSPPT.py and then MSPPTUtil.py. Then, when I run CreateSlideExamples.py (with photo.JPG's directory updated) I only get a single power-point slide with the table
The console is littered with the following list of errors:
%run C:/Users/dirkh_000/AppData/Local/Temp/Temp1_MSPPT.zip/MSO.py
%run "C:/Users/dirkh_000/Documents/Python scripts/Auto pp example/MSPPT.py"
%run "C:/Users/dirkh_000/Documents/Python scripts/Auto pp example/MSPPTUtil.py"
%run "C:/Users/dirkh_000/Documents/Python scripts/Auto pp example/CreateSlideExamples.py"
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.4.1.1975.win-x86_64\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)
195 else:
196 filename = fname
--> 197 exec compile(scripttext, filename, 'exec') in glob, loc
198 else:
199 def execfile(fname, *where):
C:\Users\dirkh_000\Documents\Python scripts\Auto pp example\CreateSlideExamples.py in <module>()
40
41 # step 3: show the slide
---> 42 presentation.create_show()
43
44 # Now you can save the slide somewhere
C:\Users\dirkh_000\Documents\Python scripts\Auto pp example\MSPPTUtil.pyc in create_show(self, visible)
45 if visible:
46 slide.select() #bring slide to front
---> 47 slide.format_slide()
48 def save_as(self, file_name):
49 self.presentation.SaveAs(file_name)
C:\Users\dirkh_000\Documents\Python scripts\Auto pp example\MSPPTUtil.pyc in format_slide(self)
64 self.slide.Select()
65 def format_slide(self):
---> 66 self.format_content()
67 self.format_title()
68 def format_title(self):
C:\Users\dirkh_000\Documents\Python scripts\Auto pp example\MSPPTUtil.pyc in format_content(self)
252 if self.title:
253 #add title
--> 254 title_range = slide.Shapes[0].TextFrame.TextRange
255 title_range.Text = self.title
256 title_range.Font.Bold = True
C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\win32com\client\__init__.pyc in __getattr__(self, attr)
463 args=self._prop_map_get_.get(attr)
464 if args is None:
--> 465 raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))
466 return self._ApplyTypes_(*args)
467
AttributeError: '<win32com.gen_py.Microsoft PowerPoint 15.0 Object Library.Shapes instance at 0x164276808>' object has no attribute '__getitem__'
Any help is appreciated. I'm running windows 8.1, powerpoint 2013.
E:\Users\liuzhijun\workspace\mysite>python manage.py shell
---------------------------------------------------------------------------
TypeError Python 2.7.4: E:\Python27\python.exe
Mon May 20 07:22:35 2013
A problem occured executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
E:\Users\liuzhijun\workspace\mysite\manage.py in ()
7 #!/usr/bin/env python
8 import os
9 import sys
---> 10
global execute_from_command_line = <function execute_from_command_line at 0x02AF94F0>
global sys.argv = ['manage.py', 'shell']
11 if __name__ == "__main__":
12 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
13
14 from django.core.management import execute_from_command_line
15
16 execute_from_command_line(sys.argv)
17
E:\Python27\lib\site-packages\django\core\management__init__.pyc in execute_from_command_line(argv=['manage.py', 'shell'])
428 )
429
430 # Import the project module. We add the parent directory to PYTHONPATH to
431 # avoid some of the path errors new users can have.
432 sys.path.append(os.path.join(project_directory, os.pardir))
433 import_module(project_name)
434 sys.path.pop()
435
436 return project_directory
437
438 def execute_from_command_line(argv=None):
439 """
440 A simple method that runs a ManagementUtility.
441 """
442 utility = ManagementUtility(argv)
--> 443 utility.execute()
444
445 def execute_manager(settings_mod, argv=None):
446 """
447 Like execute_from_command_line(), but for use by manage.py, a
448 project-specific django-admin.py utility.
449 """
450 warnings.warn(
451 "The 'execute_manager' function is deprecated, "
452 "you likely need to update your 'manage.py'; "
453 "please see the Django 1.4 release notes "
454 "(https://docs.djangoproject.com/en/dev/releases/1.4/).",
455 PendingDeprecationWarning)
456
457 setup_environ(settings_mod)
458 utility = ManagementUtility(argv)
......omit lots of codes......
update:
E:\Python27\lib\site-packages\django\core\management__init__.pyc in execute(self=)
367 elif args[2] == '--commands':
368 sys.stdout.write(self.main_help_text(commands_only=True) + '\n')
369 else:
370 self.fetch_command(args[2]).print_help(self.prog_name, args[2])
371 elif subcommand == 'version':
372 sys.stdout.write(parser.get_version() + '\n')
373 # Special-cases: We want 'django-admin.py --version' and
374 # 'django-admin.py --help' to work, for backwards compatibility.
375 elif self.argv[1:] == ['--version']:
376 # LaxOptionParser already takes care of printing the version.
377 pass
378 elif self.argv[1:] in (['--help'], ['-h']):
379 parser.print_lax_help()
380 sys.stdout.write(self.main_help_text() + '\n')
381 else:
--> 382 self.fetch_command(subcommand).run_from_argv(self.argv)
383
384 def setup_environ(settings_mod, original_settings_path=None):
385 """
386 Configures the runtime environment. This can also be used by external
387 scripts wanting to set up a similar environment to manage.py.
388 Returns the project directory (assuming the passed settings module is
389 directly in the project directory).
390
391 The "original_settings_path" parameter is optional, but recommended, since
392 trying to work out the original path from the module can be problematic.
393 """
394 warnings.warn(
395 "The 'setup_environ' function is deprecated, "
396 "you likely need to update your 'manage.py'; "
397 "please see the Django 1.4 release notes "
E:\Python27\lib\site-packages\django\core\management\base.pyc in run_from_argv(self=, argv=['manage.py', 'shell'])
181 ``self.usage()``.
182
183 """
184 parser = self.create_parser(prog_name, subcommand)
185 parser.print_help()
186
187 def run_from_argv(self, argv):
188 """
189 Set up any environment changes requested (e.g., Python path
190 and Django settings), then run this command.
191
192 """
193 parser = self.create_parser(argv[0], argv[1])
194 options, args = parser.parse_args(argv[2:])
195 handle_default_options(options)
--> 196 self.execute(*args, **options.__dict__)
global s = undefined
global appname = undefined
global appname...c = undefined
197
198 def execute(self, *args, **options):
199 """
200 Try to execute this command, performing model validation if
201 needed (as controlled by the attribute
202 ``self.requires_model_validation``). If the command raises a
203 ``CommandError``, intercept it and print it sensibly to
204 stderr.
205 """
206 show_traceback = options.get('traceback', False)
207
208 # Switch to English, because django-admin.py creates database content
209 # like permissions, and those shouldn't contain any translations.
210 # But only do this if we can assume we have a working settings file,
211 # because django.utils.translation requires settings.
E:\Python27\lib\site-packages\django\core\management\base.pyc in execute(self=, *args=(), **options={'plain': None, 'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity':'1'})
217 translation.activate('en-us')
218 except ImportError, e:
219 # If settings should be available, but aren't,
220 # raise the error and quit.
221 if show_traceback:
222 traceback.print_exc()
223 else:
224 sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
225 sys.exit(1)
226
227 try:
228 self.stdout = options.get('stdout', sys.stdout)
229 self.stderr = options.get('stderr', sys.stderr)
230 if self.requires_model_validation:
231 self.validate()
--> 232 output = self.handle(*args, **options)
global Rather = undefined
global than = undefined
global implementing = undefined
global handle = undefined
global subclasses = undefined
global must = undefined
global implement = undefined
233 if output:
234 if self.output_transaction:
235 # This needs to be imported here, because it relies on
236 # settings.
237 from django.db import connections, DEFAULT_DB_ALIAS
238 connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
239 if connection.ops.start_transaction_sql():
240 self.stdout.write(self.style.SQL_KEYWORD(connection.ops.start_transaction_sql()) + '\n')
241 self.stdout.write(output)
242 if self.output_transaction:
243 self.stdout.write('\n' + self.style.SQL_KEYWORD("COMMIT;") + '\n')
244 except CommandError, e:
245 if show_traceback:
246 traceback.print_exc()
247 else:
E:\Python27\lib\site-packages\django\core\management\base.pyc in handle(self=, *args=(), **options={'plain': None, 'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'})
356 """
357 A command which takes no arguments on the command line.
358
359 Rather than implementing ``handle()``, subclasses must implement
360 ``handle_noargs()``; ``handle()`` itself is overridden to ensure
361 no arguments are passed to the command.
362
363 Attempting to pass arguments will raise ``CommandError``.
364
365 """
366 args = ''
367
368 def handle(self, *args, **options):
369 if args:
370 raise CommandError("Command doesn't accept any arguments")
--> 371 return self.handle_noargs(**options)
372
373 def handle_noargs(self, **options):
374 """
375 Perform this command's actions.
376
377 """
378 raise NotImplementedError()
379
380
381
382
383
384
385
386
E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in handle_noargs(self=, **options={'plain': None, 'pythonpath': None, 'settings': None, 'traceback': None, 'verbos
ity': '1'})
39 pass
40 raise ImportError
41
42 def handle_noargs(self, **options):
43 # XXX: (Temporary) workaround for ticket #1796: force early loading of all
44 # models from installed apps.
45 from django.db.models.loading import get_models
46 get_models()
47
48 use_plain = options.get('plain', False)
49
50 try:
51 if use_plain:
52 # Don't bother loading IPython, because the user wants plain Python.
53 raise ImportError
---> 54 self.run_shell()
55 except ImportError:
56 import code
57 # Set up a dictionary to serve as the environment for the shell, so
58 # that tab completion works on objects that are imported at runtime.
59 # See ticket 5082.
60 imported_objects = {}
61 try: # Try activating rlcompleter, because it's handy.
62 import readline
63 except ImportError:
64 pass
65 else:
66 # We don't have to wrap the following import in a 'try', because
67 # we already know 'readline' was imported successfully.
68 import rlcompleter
69 readline.set_completer(rlcompleter.Completer(imported_objects).complete)
E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in run_shell(self=)
22 try:
23 from IPython.Shell import IPShell
24 shell = IPShell(argv=[])
25 shell.mainloop()
26 except ImportError:
27 # IPython not found at all, raise ImportError
28 raise
29
30 def bpython(self):
31 import bpython
32 bpython.embed()
33
34 def run_shell(self):
35 for shell in self.shells:
36 try:
---> 37 return getattr(self, shell)()
global t = undefined
global __name__t = undefined
38 except ImportError:
39 pass
40 raise ImportError
41
42 def handle_noargs(self, **options):
43 # XXX: (Temporary) workaround for ticket #1796: force early loading of all
44 # models from installed apps.
45 from django.db.models.loading import get_models
46 get_models()
47
48 use_plain = options.get('plain', False)
49
50 try:
51 if use_plain:
52 # Don't bother loading IPython, because the user wants plain Python.
E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in ipython(self=)
9 )
10 help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
11 shells = ['ipython', 'bpython']
12 requires_model_validation = False
13
14 def ipython(self):
15 try:
16 from IPython import embed
17 embed()
18 except ImportError:
19 # IPython < 0.11
20 # Explicitly pass an empty list as arguments, because otherwise
21 # IPython would use sys.argv from this script.
22 try:
23 from IPython.Shell import IPShell
---> 24 shell = IPShell(argv=[])
global j = undefined
global d = undefined
global s = undefined
global t = undefined
25 shell.mainloop()
26 except ImportError:
27 # IPython not found at all, raise ImportError
28 raise
29
30 def bpython(self):
31 import bpython
32 bpython.embed()
33
34 def run_shell(self):
35 for shell in self.shells:
36 try:
37 return getattr(self, shell)()
38 except ImportError:
39 pass
E:\Python27\lib\site-packages\IPython\Shell.pyc in init(self=, argv=[], user_ns=None, user_global_ns=None, debug=1, shell_class=)
58 # Default timeout for waiting for multithreaded shells (in seconds)
59 GUI_TIMEOUT = 10
60
61 #-----------------------------------------------------------------------------
62 # This class is trivial now, but I want to have it in to publish a clean
63 # interface. Later when the internals are reorganized, code that uses this
64 # shouldn't have to change.
65
66 class IPShell:
67 """Create an IPython instance."""
68
69 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
70 debug=1,shell_class=InteractiveShell):
71 self.IP = make_IPython(argv,user_ns=user_ns,
72 user_global_ns=user_global_ns,
---> 73 debug=debug,shell_class=shell_class)
global For = undefined
global more = undefined
global details = undefined
global see = undefined
global the = undefined
global __call__ = undefined
global method = undefined
global below. = undefined
74
75 def mainloop(self,sys_exit=0,banner=None):
76 self.IP.mainloop(banner)
77 if sys_exit:
78 sys.exit()
79
80 #-----------------------------------------------------------------------------
81 def kill_embedded(self,parameter_s=''):
82 """%kill_embedded : deactivate for good the current embedded IPython.
83
84 This function (after asking for confirmation) sets an internal flag so that
85 an embedded IPython will never activate again. This is useful to
86 permanently disable a shell that is being called inside a loop: once you've
87 figured out what you needed from it, you may then kill it and the program
88 will then continue to run without the interactive shell interfering again.
E:\Python27\lib\site-packages\IPython\ipmaker.pyc in make_IPython(argv=[], user_ns=None, user_global_ns=None, debug=1, rc_override=None, shell_class=, embedded=False, **kw={})
506 # tweaks. Basically options which affect other options. I guess this
507 # should just be written so that options are fully orthogonal and we
508 # wouldn't worry about this stuff!
509
510 if IP_rc.classic:
511 IP_rc.quick = 1
512 IP_rc.cache_size = 0
513 IP_rc.pprint = 0
514 IP_rc.prompt_in1 = '>>> '
515 IP_rc.prompt_in2 = '... '
516 IP_rc.prompt_out = ''
517 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
518 IP_rc.colors = 'NoColor'
519 IP_rc.xmode = 'Plain'
520
--> 521 IP.pre_config_initialization()
522 # configure readline
523
524 # update exception handlers with rc file status
525 otrap.trap_out() # I don't want these messages ever.
526 IP.magic_xmode(IP_rc.xmode)
527 otrap.release_out()
528
529 # activate logging if requested and not reloading a log
530 if IP_rc.logplay:
531 IP.magic_logstart(IP_rc.logplay + ' append')
532 elif IP_rc.logfile:
533 IP.magic_logstart(IP_rc.logfile)
534 elif IP_rc.log:
535 IP.magic_logstart()
536
E:\Python27\lib\site-packages\IPython\iplib.pyc in pre_config_initialization(self=)
820 self.user_ns, # globals
821 # Skip our own frame in searching for locals:
822 sys._getframe(depth+1).f_locals # locals
823 ))
824
825 def pre_config_initialization(self):
826 """Pre-configuration init method
827
828 This is called before the configuration files are processed to
829 prepare the services the config files might need.
830
831 self.rc already has reasonable default values at this point.
832 """
833 rc = self.rc
834 try:
--> 835 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
global prompt = undefined
global a = undefined
global string = <module 'string' from 'E:\Python27\lib\string.pyc'>
global to = undefined
global be = undefined
global printed = undefined
global the = undefined
global user. = undefined
836 except exceptions.UnicodeDecodeError:
837 print "Your ipythondir can't be decoded to unicode!"
838 print "Please set HOME environment variable to something that"
839 print r"only has ASCII characters, e.g. c:\home"
840 print "Now it is",rc.ipythondir
841 sys.exit()
842 self.shadowhist = IPython.history.ShadowHist(self.db)
843
844 def post_config_initialization(self):
845 """Post configuration init method
846
847 This is called after the configuration files have been processed to
848 'finalize' the initialization."""
849
850 rc = self.rc
E:\Python27\lib\site-packages\IPython\Extensions\pickleshare.pyc in init(self=PickleShareDB('C:\Users\liuzhijun_ipython\db'),root=u'C:\Users\liuzhijun\_ipython/db')
38 import cPickle as pickle
39 import UserDict
40 import warnings
41 import glob
42
43 def gethashfile(key):
44 return ("%02x" % abs(hash(key) % 256))[-2:]
45
46 _sentinel = object()
47
48 class PickleShareDB(UserDict.DictMixin):
49 """ The main 'connection' object for PickleShare database """
50 def __init__(self,root):
51 """ Return a db object that will manage the specied directory"""
52 self.root = Path(root).expanduser().abspath()
---> 53 if not self.root.isdir():
54 self.root.makedirs()
55 # cache has { 'key' : (obj, orig_mod_time) }
56 self.cache = {}
57
58
59 def __getitem__(self,key):
60 """ db['key'] reading """
61 fil = self.root / key
62 try:
63 mtime = (fil.stat()[stat.ST_MTIME])
64 except OSError:
65 raise KeyError(key)
66
67 if fil in self.cache and mtime == self.cache[fil][1]:
68 return self.cache[fil][0]
TypeError: _isdir() takes exactly 1 argument (0 given)
Oops, IPython crashed. We do our best to make it stable, but...
A crash report was automatically generated with the following information:
- A verbatim copy of the crash traceback.
- A copy of your input history during this session.
- Data on your current IPython configuration.
It was left in the file named:
'C:\Users\liuzhijun_ipython\IPython_crash_report.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.
You can mail it to: Fernando Perez at fperez.net#gmail.com
with the subject 'IPython Crash Report'.
If you want to do it now, the following command will work (under Unix):
mail -s 'IPython Crash Report' fperez.net#gmail.com < C:\Users\liuzhijun_ipython\IPython_crash_report.txt
To ensure accurate tracking of this issue, please file a report about it at:
https://bugs.launchpad.net/ipython/+filebug
Press enter to exit:
system env:windows8