Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4736
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "Robert Hai" <rhey@gmx.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Python Bibliothek auf iOS benutzen. |
| Date | Sun, 2 Apr 2017 08:24:35 +0200 |
| Lines | 69 |
| Message-ID | <mailman.41.1491114283.2961.python-de@python.org> (permalink) |
| References | <trinity-4cae60ae-056f-4986-874a-212c42cfad39-1491114275306@3capp-gmx-bs10> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de nNpBlin/VNO7vqu4/Dl21gpnIhf9y/WuT4yAFK8SY9Iw== |
| Return-Path | <rhey@gmx.de> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| Importance | normal |
| Sensitivity | Normal |
| X-Priority | 3 |
| X-Provags-ID | V03:K1:NkimeSBT2EDoxNHDEPKLpC2tWURuetXjKhsKZBbzfZG PKexHFGPFQi5l4xb6c6VgnZUvjTmOxfUcxLSNEKMhbFlEvzZ/x 6h2DLlk7ZLPN5zGxquYunl7epaBkrQiVIhI7he4LY4aEQV5MMG +Ibf6UCZH0YRdT5IXViQ5f4rrM72/jRpzpRSizMqs4XLeqjDSH OGwfZ8tLgEJC+jXstgJA67Of6Lp0IBBQZfXcC1qTZ/j1XWPCpY YGhR8zy3Y3dKALm/wIm/QbVuSXwT5NPaiyl2Y6Nu+oacbwPpEW CtpEXo= |
| X-UI-Out-Filterresults | notjunk:1;V01:K0:oQu8bC0mhvA=:7TG1wo+oIPVcWesXge+BXu QSVNCUgJD85TPC0uJ9qjAyVc6iWX+TRUCueVtyavsEfJd3NsW4zGTB0m/ZfR9EQFozPK/Qxg4 hqZNzEZfqZdqbwpow6mgiQx5ucu5GWn0B8QdgYdFj+5eNu+bHjq7Jj8id+ZtGT1HpifaTii4S o2pBICb6xOWn3fak9EeQey7CS2GbQCwEHlSioVpC4ZNpwx1kZiqjvjxcRkNEXra3ZZkjclUqE OW6leWCOD8VwX1HqDU6mWlPum8AY2j+TkJhp78+MWOvW6rkhy0EDd8HJwTxDDD1e3ypTVXxCe asL8sPPJYywsLXYt3fVRIWeaMvCxrX+gfBAiQE3OGez+THY8maPNVvgtaEWjcvEg2xmKP8LeS gLF+478csQGeGP5o4EReaN+HOq4KnBQRlCJKCoY/Y1VoShGgZpV+xPQSP7pf2SUiN3/kZzhYF 60EpxoUDkA== |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <trinity-4cae60ae-056f-4986-874a-212c42cfad39-1491114275306@3capp-gmx-bs10> |
| Xref | csiph.com de.comp.lang.python:4736 |
Show key headers only | View raw
Vielen Dank ! Der Link funktioniert jetzt auch ! Habe mir das template (http://omz-software.com/pythonista/download/PythonistaProjectTemplate.zip) jetzt runtergeladen und damit rumgespielt. Für meine App wäre es aber jetzt noch von Bedeutung, dass der Output folgdener Zeilen :
//Run the main script:
if (scriptPath) {
NSString *script = @"from sympy import *\ninit_printing(use_unicode=True)\nx = Symbol('x')\nprint(solve(x**2 - 1, x))";
if (script) {
[[PythonInterpreter sharedInterpreter] run:script asFile:scriptPath];
} else {
NSLog(@"Could not load main.py (make sure its encoding is UTF-8)");
}
} else {
NSLog(@"Could not find main.py");
}
Nicht in den OMTextView geht sondern in einen String oder sonst wo, wo ich ihn benutzen kann. Das captureoutput script sieht folgendermaßen aus :
def _capture_output_main():
import _outputcapture
import sys
class StdoutCatcher (object):
def __init__(self):
self.encoding = 'utf8'
def write(self, s):
if isinstance(s, str):
_outputcapture.CaptureStdout(s)
elif isinstance(s, unicode):
_outputcapture.CaptureStdout(s.encode('utf8'))
def writelines(self, lines):
for line in lines:
self.write(line + '\n')
def flush(self):
pass
class StderrCatcher (object):
def __init__(self):
self.encoding = 'utf8'
def write(self, s):
if isinstance(s, str):
_outputcapture.CaptureStderr(s)
elif isinstance(s, unicode):
_outputcapture.CaptureStderr(s.encode('utf8'))
def flush(self):
pass
class StdinCatcher (object):
def __init__(self):
self.encoding = 'utf8'
def read(self, len=-1):
return _outputcapture.ReadStdin(len)
def readline(self):
return _outputcapture.ReadStdin()
sys.stdout = StdoutCatcher()
sys.stderr = StderrCatcher()
sys.stdin = StdinCatcher()
_capture_output_main()
del _capture_output_main
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Python Bibliothek auf iOS benutzen. "Robert Hai" <rhey@gmx.de> - 2017-04-02 08:24 +0200
csiph-web