I'm trying to open the Sage's notebook, but it isn't working.
I have no idea where this error came from, because the notebook was working this week. I guess it just popped up out of nowhere.
The message's error is:
sage: notebook()
---------------------------------------------------------------------------
EnvironmentError Traceback (most recent call last)
<ipython-input-4-3728cb3d7c7d> in <module>()
----> 1 notebook()
/home/jerome/opt/SageMath/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (/home/jerome/opt/SageMath/src/build/cythonized/sage/misc/lazy_import.c:3634)()
384 True
385 """
--> 386 return self._get_object()(*args, **kwds)
387
388 def __repr__(self):
/home/jerome/opt/SageMath/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (/home/jerome/opt/SageMath/src/build/cythonized/sage/misc/lazy_import.c:2241)()
244 elif self._at_startup and not startup_guard:
245 print('Option ``at_startup=True`` for lazy import {0} not needed anymore'.format(self._name))
--> 246 self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name)
247 alias = self._as_name or self._name
248 if self._deprecation is not None:
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/sagenb/notebook/notebook_object.py in <module>()
15 import time, os, shutil, signal, tempfile
16
---> 17 import notebook as _notebook
18
19 import run_notebook
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/sagenb/notebook/notebook.py in <module>()
33
34 # Sage libraries
---> 35 from sagenb.misc.misc import (pad_zeros, cputime, tmp_dir, load, save,
36 ignore_nonexistent_files, unicode_str)
37
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/sagenb/misc/misc.py in <module>()
379
380 try:
--> 381 from sage.misc.cython import cython
382 except ImportError:
383 #stub
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/sage/misc/cython.py in <module>()
28
29 # CBLAS can be one of multiple implementations
---> 30 cblas_pc = pkgconfig.parse('cblas')
31 cblas_libs = list(cblas_pc['libraries'])
32 cblas_library_dirs = list(cblas_pc['library_dirs'])
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/pkgconfig-1.1.0-py2.7.egg/pkgconfig/pkgconfig.py in parse(packages)
185
186 for package in packages.split():
--> 187 for k, v in parse_package(package).items():
188 result[k].update(v)
189
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/pkgconfig-1.1.0-py2.7.egg/pkgconfig/pkgconfig.py in parse_package(package)
158
159 # Execute the query to pkg-config and clean the result.
--> 160 out = _query(package, '--cflags --libs')
161 out = out.replace('\\"', '')
162
/home/jerome/opt/SageMath/local/lib/python2.7/site-packages/pkgconfig-1.1.0-py2.7.egg/pkgconfig/pkgconfig.py in _wrapper(*args, **kwargs)
56 return func(*args, **kwargs)
57 except OSError:
---> 58 raise EnvironmentError("pkg-config is not installed")
59
60 return _wrapper
EnvironmentError: pkg-config is not installed
If you guys can help me, I'll be very thankful!
Related
I am attempting to import tensorflow - my kernel is an anaconda environment. When I run "import tensorflow" using the Anaconda terminal it works perfectly but once I try the same in Atom it throws the following Error:
---------------------------------------------------------------------------
DecodeError Traceback (most recent call last)
<ipython-input-4-d6579f534729> in <module>
----> 1 import tensorflow
~\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25
26 from tensorflow._api.v1 import app
~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
50
51 # Protocol buffers
---> 52 from tensorflow.core.framework.graph_pb2 import *
53 from tensorflow.core.framework.node_def_pb2 import *
54 from tensorflow.core.framework.summary_pb2 import *
~\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py in <module>
13
14
---> 15 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
16 from tensorflow.core.framework import function_pb2 as tensorflow_dot_core_dot_framework_dot_function__pb2
17 from tensorflow.core.framework import versions_pb2 as tensorflow_dot_core_dot_framework_dot_versions__pb2
~\Anaconda3\lib\site-packages\tensorflow\core\framework\node_def_pb2.py in <module>
13
14
---> 15 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
16
17
~\Anaconda3\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py in <module>
346 AttrEntry = _reflection.GeneratedProtocolMessageType('AttrEntry', (_message.Message,), dict(
347 DESCRIPTOR = _NAMEATTRLIST_ATTRENTRY,
--> 348 __module__ = 'tensorflow.core.framework.attr_value_pb2'
349 # ##protoc_insertion_point(class_scope:tensorflow.NameAttrList.AttrEntry)
350 ))
~\Anaconda3\lib\site-packages\google\protobuf\internal\python_message.py in __init__(cls, name, bases, dictionary)
181 cls._decoders_by_tag = {}
182 if (descriptor.has_options and
--> 183 descriptor.GetOptions().message_set_wire_format):
184 cls._decoders_by_tag[decoder.MESSAGE_SET_ITEM_TAG] = (
185 decoder.MessageSetItemDecoder(descriptor), None)
~\Anaconda3\lib\site-packages\google\protobuf\descriptor.py in GetOptions(self)
158 else:
159 self._options = _ParseOptions(options_class(),
--> 160 self._serialized_options)
161
162 return self._options
~\Anaconda3\lib\site-packages\google\protobuf\descriptor.py in _ParseOptions(message, string)
924 proto2 files. It must not be used outside proto2.
925 """
--> 926 message.ParseFromString(string)
927 return message
928
~\Anaconda3\lib\site-packages\google\protobuf\message.py in ParseFromString(self, serialized)
185 """
186 self.Clear()
--> 187 return self.MergeFromString(serialized)
188
189 def SerializeToString(self, **kwargs):
~\Anaconda3\lib\site-packages\google\protobuf\internal\python_message.py in MergeFromString(self, serialized)
1123 length = len(serialized)
1124 try:
-> 1125 if self._InternalParse(serialized, 0, length) != length:
1126 # The only reason _InternalParse would return early is if it
1127 # encountered an end-group tag.
~\Anaconda3\lib\site-packages\google\protobuf\internal\python_message.py in InternalParse(self, buffer, pos, end)
1175 old_pos = new_pos
1176 (data, new_pos) = decoder._DecodeUnknownField(
-> 1177 buffer, new_pos, wire_type) # pylint: disable=protected-access
1178 if new_pos == -1:
1179 return pos
~\Anaconda3\lib\site-packages\google\protobuf\internal\decoder.py in _DecodeUnknownField(buffer, pos, wire_type)
950 return (0, -1)
951 else:
--> 952 raise _DecodeError('Wrong wire type in tag.')
953
954 return (data, pos)
DecodeError: Wrong wire type in tag.
Let me know if you have any idea how to fix that!
Using windows 10, python 3.7, anaconda and hydrogen. Computer restart and tensorflow/protobuf reinstall haven't helped.
Thanks!
I'm new to Python and I'm trying to divide a whole number column by the number of keys in my dictionary. I have added + 1 to the denominator to avoid division by 0 but still I'm getting the ZeroDivisionError.
Any help is appreciated. Thanks!
Code:
Questions_not_Duplicate_v2['bigram_match_frac'] = Questions_not_Duplicate_v2.apply(lambda x: (x['bigram_match']*1.0)/(len(set(x['bi_gram_1'].keys()))+1))
Questions_not_Duplicate_v2['bigram_match_frac'].show()
Error :
RuntimeError Traceback (most recent call last)
<ipython-input-73-4e14321362d6> in <module>()
----> 1 Questions_not_Duplicate_v2['bigram_match_frac'].show()
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\data_structures\sarray.pyc in show(self, view)
2853 """
2854 from ..visualization.show import show
-> 2855 show(self, view=view)
2856
2857 def item_length(self):
C:\Users\rakesh\Anaconda2\lib\site-packages\multipledispatch\dispatcher.pyc in __call__(self, *args, **kwargs)
162 self._cache[types] = func
163 try:
--> 164 return func(*args, **kwargs)
165
166 except MDNotImplementedError:
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\canvas\glc_display_dispatch.pyc in show(obj, **kwargs)
19
20 graphlab.canvas.inspect.find_vars(obj)
---> 21 return graphlab.canvas.show(graphlab.canvas.views.sarray.SArrayView(obj, params=kwargs))
22
23
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\canvas\utils.pyc in show(variable)
129 get_target().state.set_selected_variable(variable)
130 variable.validate_js_component_name(variable.get_js_component())
--> 131 return get_target().show()
132
133 def _get_id(ref):
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\canvas\target.pyc in show(self, variable)
169 'ipython': True,
170 }
--> 171 data.update(view.get_staticdata())
172
173 import IPython
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\canvas\views\sarray.pyc in get_staticdata(self)
67 }
68 return {
---> 69 'sketch': self.get_sketch(background=False),
70 'histogram': self.__get_histogram_static()
71 }
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\canvas\views\sarray.pyc in get_sketch(self, background, cached_only)
297 else:
298 if self.__cached_sketch is None:
--> 299 self.__cached_sketch = sa.sketch_summary(background=background)
300 sk = self.__cached_sketch
301 if issubclass(sa.dtype(), dict):
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\data_structures\sarray.pyc in sketch_summary(self, background, sub_sketch_keys)
2742 sub_sketch_keys = list()
2743
-> 2744 return Sketch(self, background, sub_sketch_keys = sub_sketch_keys)
2745
2746 def append(self, other):
C:\Users\rakesh\Anaconda2\lib\site-packages\graphlab\data_structures\sketch.pyc in __init__(self, array, background, sub_sketch_keys, _proxy)
170 raise TypeError("Sketch object can only be constructed from SArrays")
171
--> 172 self.__proxy__.construct_from_sarray(array.__proxy__, background, sub_sketch_keys)
173
174 def __repr__(self):
graphlab\cython\cy_sketch.pyx in
graphlab.cython.cy_sketch.UnitySketchProxy.construct_from_sarray()
graphlab\cython\cy_sketch.pyx in
graphlab.cython.cy_sketch.UnitySketchProxy.construct_from_sarray()
RuntimeError: Runtime Exception. Exception in python callback function evaluation:
ZeroDivisionError('float division by zero',):
Traceback (most recent call last):
File "graphlab\cython\cy_pylambda_workers.pyx", line 450, in graphlab.cython.cy_pylambda_workers._eval_lambda_by_sframe_rows
File "graphlab\cython\cy_pylambda_workers.pyx", line 221, in graphlab.cython.cy_pylambda_workers.lambda_evaluator.eval_sframe_rows
File "<ipython-input-61-c7d77added1c>", line 3, in <lambda>
ZeroDivisionError: float division by zero
The error seems very similar to : Python 2.7 - GraphLab : ZeroDivisionError: float division by zero, but I haven't been able to figure it out.
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've installed SQLAlchemy, ipython-sql, and IBM_DB support for SQLAlchemy. Link for the last one is one found on SQLAlchemy site and it's https://code.google.com/p/ibm-db/wiki/README.
I'm using python3 as my kernel in ipython and of course I used easy_install3
%load_ext sql
%sql ibm_db_sa://bpadmin:bpadmin#192.168.2.128/studAdmin
And I got the following error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-ca75a37d0cce> in <module>()
----> 1 get_ipython().magic('sql ibm_db_sa://bpadmin:bpadmin#192.168.2.128/studAdmin')
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2164 magic_name, _, magic_arg_s = arg_s.partition(' ')
2165 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2166 return self.run_line_magic(magic_name, magic_arg_s)
2167
2168 #-------------------------------------------------------------------------
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2085 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2086 with self.builtin_trap:
-> 2087 result = fn(*args,**kwargs)
2088 return result
2089
/usr/local/lib/python3.4/dist-packages/sql/magic.py in execute(self, line, cell, local_ns)
/usr/lib/python3/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
190 # but it's overkill for just that one bit of state.
191 def magic_deco(arg):
--> 192 call = lambda f, *a, **k: f(*a, **k)
193
194 if isinstance(arg, collections.Callable):
/usr/local/lib/python3.4/dist-packages/sql/magic.py in execute(self, line, cell, local_ns)
/usr/lib/python3/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
190 # but it's overkill for just that one bit of state.
191 def magic_deco(arg):
--> 192 call = lambda f, *a, **k: f(*a, **k)
193
194 if isinstance(arg, collections.Callable):
/usr/local/lib/python3.4/dist-packages/sql/magic.py in execute(self, line, cell, local_ns)
73
74 parsed = sql.parse.parse('%s\n%s' % (line, cell), self)
---> 75 conn = sql.connection.Connection.get(parsed['connection'])
76 first_word = parsed['sql'].split(None, 1)[:1]
77 if first_word and first_word[0].lower() == 'persist':
/usr/local/lib/python3.4/dist-packages/sql/connection.py in get(cls, descriptor)
30 cls.current = conn
31 else:
---> 32 cls.current = Connection(descriptor)
33 if cls.current:
34 return cls.current
/usr/local/lib/python3.4/dist-packages/sql/connection.py in __init__(self, connect_str)
10 def __init__(self, connect_str=None):
11 try:
---> 12 engine = sqlalchemy.create_engine(connect_str)
13 except: # TODO: bare except; but what's an ArgumentError?
14 print(self.tell_format())
/usr/local/lib/python3.4/dist-packages/sqlalchemy/engine/__init__.py in create_engine(*args, **kwargs)
384 strategy = kwargs.pop('strategy', default_strategy)
385 strategy = strategies.strategies[strategy]
--> 386 return strategy.create(*args, **kwargs)
387
388
/usr/local/lib/python3.4/dist-packages/sqlalchemy/engine/strategies.py in create(self, name_or_url, **kwargs)
49 u = url.make_url(name_or_url)
50
---> 51 dialect_cls = u.get_dialect()
52
53 if kwargs.pop('_coerce_config', False):
/usr/local/lib/python3.4/dist-packages/sqlalchemy/engine/url.py in get_dialect(self)
127 else:
128 name = self.drivername.replace('+', '.')
--> 129 cls = registry.load(name)
130 # check for legacy dialects that
131 # would return a module with 'dialect' as the
/usr/local/lib/python3.4/dist-packages/sqlalchemy/util/langhelpers.py in load(self, name)
188 self.group, name):
189 self.impls[name] = impl.load
--> 190 return impl.load()
191
192 raise exc.NoSuchModuleError(
/usr/lib/python3/dist-packages/pkg_resources.py in load(self, require, env, installer)
2086 def load(self, require=True, env=None, installer=None):
2087 if require: self.require(env, installer)
-> 2088 entry = __import__(self.module_name, globals(),globals(), ['__name__'])
2089 for attr in self.attrs:
2090 try:
/usr/local/lib/python3.4/dist-packages/ibm_db_sa-0.3.2-py3.4.egg/ibm_db_sa/__init__.py in <module>()
20 __version__ = '0.3.2'
21
---> 22 from . import ibm_db, pyodbc, base, zxjdbc
23
24
/usr/local/lib/python3.4/dist-packages/ibm_db_sa-0.3.2-py3.4.egg/ibm_db_sa/ibm_db.py in <module>()
18 # +--------------------------------------------------------------------------+
19
---> 20 from .base import DB2ExecutionContext, DB2Dialect
21 from sqlalchemy import processors, types as sa_types, util
22 from sqlalchemy import __version__ as SA_Version
/usr/local/lib/python3.4/dist-packages/ibm_db_sa-0.3.2-py3.4.egg/ibm_db_sa/base.py in <module>()
34 VARCHAR, FLOAT
35
---> 36 SA_Version = [long(ver_token) for ver_token in SA_Version.split('.')[0:2]]
37
38 # as documented from:
/usr/local/lib/python3.4/dist-packages/ibm_db_sa-0.3.2-py3.4.egg/ibm_db_sa/base.py in <listcomp>(.0)
34 VARCHAR, FLOAT
35
---> 36 SA_Version = [long(ver_token) for ver_token in SA_Version.split('.')[0:2]]
37
38 # as documented from:
NameError: name 'long' is not defined
Format: (postgresql|mysql)://username:password#hostname/dbname, or one of dict_keys([])
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