Skip to content

Commit bc07afb

Browse files
committed
fix missing pie.csv problem
1 parent c8bd7b8 commit bc07afb

11 files changed

+9
-2
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/source/pyexcel_sphinx_integration.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
from docutils.parsers.rst import Directive
2525
from traceback import format_exc, print_exc
2626
from sphinx.directives.code import CodeBlock
27+
from sphinx.util.i18n import search_image_for_language
2728

2829
import docutils.core
2930
import pyexcel
3031
import sys
32+
import os
3133

3234
PY2 = sys.version_info[0] == 2
3335

@@ -45,7 +47,12 @@ class PygalDirective(Directive):
4547
has_content = True
4648

4749
def run(self):
48-
content = list(self.content)
50+
env = self.state.document.settings.env
51+
fn = search_image_for_language('pie.csv', env)
52+
relfn, excel_file = env.relfn2path(fn)
53+
working_path = os.path.dirname(excel_file)
54+
content = ["import os", "os.chdir('%s')" % working_path]
55+
content += list(self.content)
4956
code = '\n'.join(content)
5057
scope = {'pyexcel': pyexcel}
5158
try:
@@ -98,4 +105,4 @@ def setup(app):
98105
app.add_directive('pyexcel-chart', PygalDirective)
99106
app.add_directive('pyexcel-code', PygalWithCode)
100107

101-
return {'version': '1.0.1'}
108+
return {'version': '1.0.1'}
File renamed without changes.

0 commit comments

Comments
 (0)