cjdrake / ipython-magic Goto Github PK
View Code? Open in Web Editor NEWIPython Magic Functions
License: BSD 2-Clause "Simplified" License
IPython Magic Functions
License: BSD 2-Clause "Simplified" License
My version 6.1.0, and when I try to %load_ext gvmagic
, I get the error message 'ImportError: No module named 'IPython.utils.warn''
Dear Chris,
could you please make ipython-magic available via PyPI?
So far, I have been able to use it via IPython's %install_ext
magic, but that is no longer available.
Best regards,
Arne
I'm trying to make one of your extensions work (completely new to IPython, first notebook, first code I'm writing in python)... It's going well, trying to plot strings, like one would expect, but I'm not sure how to make objects plottable... I'm getting this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-b880cdad6015> in <module>()
----> 1 get_ipython().magic('dotobj fig6')
/Users/h/.pyenv/versions/3.5.0/lib/python3.5/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
2334 magic_name, _, magic_arg_s = arg_s.partition(' ')
2335 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2336 return self.run_line_magic(magic_name, magic_arg_s)
2337
2338 #-------------------------------------------------------------------------
/Users/h/.pyenv/versions/3.5.0/lib/python3.5/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
2255 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2256 with self.builtin_trap:
-> 2257 result = fn(*args,**kwargs)
2258 return result
2259
/Users/h/.ipython/extensions/gvmagic.py in dotobj(self, line)
/Users/h/.pyenv/versions/3.5.0/lib/python3.5/site-packages/IPython/core/magic.py in <lambda>(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/h/.ipython/extensions/gvmagic.py in dotobj(self, line)
52 @line_magic
53 def dotobj(self, line):
---> 54 self._from_obj(line, 'dot')
55
56 @line_magic
/Users/h/.ipython/extensions/gvmagic.py in _from_obj(self, line, layout_engine)
162 error("expected to_dot method to be callable w/o args")
163 else:
--> 164 data = run_graphviz(s, layout_engine)
165 if data:
166 display_svg(data, raw=True)
/Users/h/.ipython/extensions/gvmagic.py in run_graphviz(s, layout_engine)
29
30 dot = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
---> 31 stdoutdata, stderrdata = dot.communicate(s.encode('utf-8'))
32 status = dot.wait()
33 if status == 0:
AttributeError: 'Dot' object has no attribute 'encode'
For code on the instance fig6
, like:
def to_dot(self, Args=set()):
if type(Args) is not set:
Args = set(Args)
try:
graph = pydot.Dot()
except NameError:
print("Not able to import pydot. This functionality will not work.")
return
for arg in self._Ar:
graph.add_node(pydot.Node(str(arg), shape='circle'))
for attack in self._df:
graph.add_edge(pydot.Edge(str(attack.attacker), str(attack.attacked)))
for arg in Args:
graph.get_node(str(arg)).pop().set_shape('doublecircle')
return graph
With requirements.txt
:
-e git+https://github.com/nlhepler/pydot.git@adf18a858a63b321b7e4ffd964a24d73add1bf4f#egg=pydot-master
pyparsing==2.0.6
Since I'm so new at this, I don't really know how to continue...?
PS, also getting. Is this normal?
/Users/h/.pyenv/versions/3.5.0/lib/python3.5/site-packages/IPython/core/magics/extension.py:47: UserWarning: %install_ext` is deprecated, please distribute your extension(s)as a python packages.
"as a python packages.", UserWarning)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.