diff --git a/demo/app/build.gradle.kts b/demo/app/build.gradle.kts index 281846dc04..e0d1d648a6 100644 --- a/demo/app/build.gradle.kts +++ b/demo/app/build.gradle.kts @@ -23,12 +23,12 @@ afterEvaluate { android { namespace = "com.chaquo.python.demo" - compileSdk = 34 + compileSdk = 35 defaultConfig { applicationId = "com.chaquo.python.demo3" minSdk = 24 - targetSdk = 34 + targetSdk = 35 val plugins = buildscript.configurations.getByName("classpath") .resolvedConfiguration.resolvedArtifacts.map { @@ -97,7 +97,7 @@ chaquopy { defaultConfig { // Android UI demo pip { - install("Pygments==2.2.0") // Also used in Java API demo + install("Pygments==2.13.0") // Also used in Java API demo } staticProxy("chaquopy.demo.ui_demo") diff --git a/demo/app/src/utils/python/chaquopy/utils/console.py b/demo/app/src/utils/python/chaquopy/utils/console.py index ec84908ebb..b6931bd519 100644 --- a/demo/app/src/utils/python/chaquopy/utils/console.py +++ b/demo/app/src/utils/python/chaquopy/utils/console.py @@ -77,7 +77,7 @@ def __repr__(self): def __getattribute__(self, name): # Forward all attributes that have useful implementations. if name in [ - "close", "closed", "flush", "writable", # IOBase + "close", "closed", "fileno", "flush", "writable", # IOBase "encoding", "errors", "newlines", "buffer", "detach", # TextIOBase "line_buffering", "write_through", "reconfigure", # TextIOWrapper ]: @@ -90,5 +90,9 @@ def write(self, s): # exception, the app crashes in the same way whether it's using # ConsoleOutputStream or not. result = self.stream.write(s) + + # In case `s` is a str subclass that writes itself to stdout or stderr + # when we call its methods, convert it to an actual str. + s = str.__str__(s) self.method(s) return result diff --git a/demo/app/src/utils/res/values-v35/utils.xml b/demo/app/src/utils/res/values-v35/utils.xml new file mode 100644 index 0000000000..99471bc758 --- /dev/null +++ b/demo/app/src/utils/res/values-v35/utils.xml @@ -0,0 +1,9 @@ + + + + + +