Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Robert Hai" 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: References: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com de.comp.lang.python:4736 Vielen Dank ! Der Link funktioniert jetzt auch ! Habe mir das template (htt= p://omz-software=2Ecom/pythonista/download/PythonistaProjectTemplate=2Ezip)= jetzt runtergeladen und damit rumgespielt=2E F=C3=BCr meine App w=C3=A4re = es aber jetzt noch von Bedeutung, dass der Output folgdener Zeilen : =C2=A0 //Run the main script: =C2=A0=C2=A0 =C2=A0if (scriptPath) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 NSString *script =3D @"from sympy import *\nin= it_printing(use_unicode=3DTrue)\nx =3D Symbol('x')\nprint(solve(x**2 - 1, x= ))"; =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (script) { =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0[[PythonInterpret= er sharedInterpreter] run:script asFile:scriptPath]; =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} else { =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0NSLog(@"Could not= load main=2Epy (make sure its encoding is UTF-8)"); =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0 =C2=A0} else { =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0NSLog(@"Could not find main=2Epy"); =C2=A0=C2=A0 =C2=A0} Nicht in den OMTextView geht sondern in einen String oder sonst wo, wo ich= ihn benutzen kann=2E Das captureoutput script sieht folgenderma=C3=9Fen au= s : def _capture_output_main(): import _outputcapture import sys class StdoutCatcher (object): def __init__(self): self=2Eencoding =3D 'utf8' def write(self, s): if isinstance(s, str): _outputcapture=2ECaptureStdout(s) elif isinstance(s, unicode): _outputcapture=2ECaptureStdout(s=2Eencode('utf8')) def writelines(self, lines): for line in lines: self=2Ewrite(line + '\n') def flush(self): pass class StderrCatcher (object): def __init__(self): self=2Eencoding =3D 'utf8' def write(self, s): if isinstance(s, str): _outputcapture=2ECaptureStderr(s) elif isinstance(s, unicode): _outputcapture=2ECaptureStderr(s=2Eencode('utf8')) def flush(self): pass class StdinCatcher (object): def __init__(self): self=2Eencoding =3D 'utf8' def read(self, len=3D-1): return _outputcapture=2EReadStdin(len) =09 def readline(self): return _outputcapture=2EReadStdin() sys=2Estdout =3D StdoutCatcher() sys=2Estderr =3D StderrCatcher() sys=2Estdin =3D StdinCatcher() _capture_output_main() del _capture_output_main