Dear all,
I am using Ben Jann's -texdoc- to write some text about the integration of Python in Stata. In this text, there is the following structure:
This works in the sense that it runs withouth errors. However, in the PDF that is finally produced, I get:
Some LaTeX that explains Stata and Python.
. python
. from sfi import Data
. end
some following up LaTeX
. python
. myname = Data.get("ybirth")
. end
Instead of this, I would like -python- to be called only once at the beginning, and -end- only once at the end. Is there a way to achieve this?
My idea was to use -stata.run()- from -pystata- to issue the commands -texdoc stlog close- and -texdoc stlog- from the python environment:
but stata.run() crashes the running Stata 18 instance (Linux Ubuntu). I guess -pystata- just isn't meant to be run from within a python environment started within Stata.
Does anybody have another solution? (This is a larger project that went quite far already, so working from Python completely, or getting rid of -texdoc- is not really an option)
Many regards
Uli
I am using Ben Jann's -texdoc- to write some text about the integration of Python in Stata. In this text, there is the following structure:
Code:
Some LaTeX that explains Stata and Python. ***/ texdoc stlog python from sfi import Data end texdoc stlog close /*** some following up LaTeX ***/ texdoc stlog python myname = Data.get("ybirth") end texdoc stlog close /***
Some LaTeX that explains Stata and Python.
. python
. from sfi import Data
. end
some following up LaTeX
. python
. myname = Data.get("ybirth")
. end
Instead of this, I would like -python- to be called only once at the beginning, and -end- only once at the end. Is there a way to achieve this?
My idea was to use -stata.run()- from -pystata- to issue the commands -texdoc stlog close- and -texdoc stlog- from the python environment:
Code:
. python >>> import stata_setup >>> stata_setup.config('/usr/local/stata18','se') >>> from pystata import stata >>> stata.run("texdoc stlog")
Does anybody have another solution? (This is a larger project that went quite far already, so working from Python completely, or getting rid of -texdoc- is not really an option)
Many regards
Uli
Comment