diff options
author | Olly Betts <olly@survex.com> | 2015-06-29 22:24:53 +1200 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2015-06-29 22:24:59 +1200 |
commit | 8208d12aa55fff495685f6b58c0db4f4c9721278 (patch) | |
tree | a61274064283552701b52e7647f01e135902749c /Doc/Manual/Python.html | |
parent | 822b2355c0a88143274853afa520406b67c41082 (diff) | |
download | swig-8208d12aa55fff495685f6b58c0db4f4c9721278.tar.gz |
Document use of %pythoncode "file.py"
As discussed in github issue #379.
Diffstat (limited to 'Doc/Manual/Python.html')
-rw-r--r-- | Doc/Manual/Python.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index 23c2aaae3..0cbb38021 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -3382,6 +3382,18 @@ problems, for example: <tt># error handling</tt>). SWIG 3.0.3 and later report an error for invalid preprocessor directives, so you may have to update existing interface files to delimit blocks of Python code correctly.</p> +<p>As an alternative to providing a block containing Python code, you can +include python code from a file. The code is inserted exactly as in the +file, so this avoids any issues with the SWIG preprocessor. It's a good +approach if you have a non-trivial chunk of Python code to insert. To +use this feature you specify a filename in double quotes, for example:</p> + +<div class="code"> +<pre> +%pythoncode "somecode.py" +</pre> +</div> + <p>Sometimes you may want to replace or modify the wrapper function that SWIG creates in the proxy <tt>.py</tt> file. The Python module in SWIG provides some features that enable you to do this. First, to |