Forum Archive

Beta Status Update

omz

Unfortunately, I've recently been unable to provide a new beta version of Pythonista 1.6. This is partly my own fault, and partly due to unexpected difficulties with TestFlight.

First off, I've been working on two different branches of Pythonista for quite some time, one being the current (expired) 1.6 beta, a relatively minor update with new Python modules but not much else, the other a more significant update with a major UI refresh and quite a few other new features that I'm pretty excited about (more on that soon).

This approach has sometimes made it difficult to keep both versions in a working state. When I changed something in version B, I sometimes ended up accidentally breaking stuff in version A... So a couple of weeks ago, I decided to ditch the current beta branch, and exclusively focus on the new version instead, but I have to admit that I vastly underestimated the amount of work that this would take – a lot of basic things were still missing in the new branch, and even though it had some nice new features, it would have been a step down in terms of stability and basic functionality that you'd expect, even if you were coming from 1.5.

Right now, it's still a bit rough around the edges, but definitely usable and an improvement over the current version. Unfortunately, I haven't been able to get TestFlight to work with it yet. I continue running into server-side issues with builds not processing properly after I upload them. In order to make some new features work, I had to change the App ID (for code-signing), and it seems that this is a scenario that just doesn't work very well with TestFlight – it's difficult to go back now because that would mean sacrificing new functionality that I spent quite a lot of time on... At first, the only reason for the new App ID requirement was the document picker support in the new dialogs module (requires iCloud entitlements), but the new version also contains an app extension (for running scripts from the share sheet in other apps), and I've realized now that this also doesn't work with the old App ID, and while the document picker support wasn't that important to me, the app extension is a major feature that I really want to ship.

If you do have the current (expired) beta installed and would like to get your data out of it, here are two options you can use:

Option 1 (if you have a Mac with Xcode):

  • Connect your device via USB
  • Start Xcode and select Devices from the Window menu, then select the connected device in the sidebar
  • Under Installed Apps, select Pythonista
  • Click on the "Gear" icon and select Download Container...

The downloaded container is a package (i.e. folder), so you can view the individual files in Finder by selecting Show Package Contents from the context menu.

Option 2 (if you're on a PC or don't want to install Xcode):

  • Make an unencrypted(!) backup of your device using iTunes
  • Download the iBackup Viewer tool (Mac or Windows) – (the free version will do, if you have the paid version, you could also encrypt your backup)
  • Go to "(your device)/Applications" (this may take a while to load)
  • Select Pythonista in the list of apps, then click the "gear" button and select Save all Files.... I would recommend that you create a new folder for this because the app will create multiple folders while extracting the backup files.

Edit: You can also try downgrading by downloading 1.5 from the App Store. Apparently, this didn't result in data loss for some people, but I'm not quite sure if this always works.

That's all I have for now. I'm very sorry this took so long. When I know more, I'll post it here.

omz

Here are a couple of screenshots of what the beta currently looks like (click on thumbnails for full-size versions):

Screenshot
Screenshot
Screenshot

Screenshot

The app extension, running in Safari:

Screenshot
Screenshot

wradcliffe

OK - my heart is fibrulating. Just seeing the MIDI support in there is enough, but the UI and game development tools look awesome. This is going to be a major upgrade. Thanks so much for getting some of these features in there. On the MIDI side of things - make sure to expose that crazy MIDI - BLE dialog box API. It is needed to write apps that enable BLE MIDI via CoreMIDI. You probably already know that - but just in case :-)

One dumb question. I can't find a way to reinstall 1.5 over the expired beta on my iPad. Is that something that has to be done from iTunes on my PC? A pointer on how this can be done would be helpful as I wait patiently for this next incredible upgrade.

dgelessus

Well this is some great news! I certainly wasn't expecting this. MIDI library, visual scene designer, more themes, more syntax highlighting support, app extension... and are those input history buttons on the interactive prompt? It's great to see what you've been secretly working on all the time. Hopefully you'll be able to resolve your problems with TestFlight etc. soon, good luck with that. Can't use Pythonista in the meantime then, but my data is safe and backed up, so I'll be patiently waiting for now. In any case, glad to hear that you're alright. Willkommen zurück Ole :)

briarfox

@omz Thank you for updating us. Looking forward to the new build! It looks awesome. Game Dev tools look like a lot of fun. In the end it is we that signed up to test builds, and unfortunately that sometimes means there will be issues. Keep up the great work!

omz

@wradcliffe, @dgelessus

I'm sorry if those screenshots gave you the wrong impression about MIDI support. There's a tiny bit of that, but probably not what you actually want. There's very basic playback support for .mid files (with a built-in soundbank), and I've included the pure-Python midiutil module for creating MIDI files (which actually works in 1.5 as well if you'd download it manually), and that's it, nothing related to CoreMIDI, really, and I don't think I'll get to that for this update, just too much other stuff I'll need to get done still, and this is an area I know very little about.

It can still be fun to generate melodies algorithmically this way, and you might be able to do more with the results by exporting a .mid file to another app, but you won't be able to use Pythonista as some sort of MIDI controller or anything like that.

wradcliffe

@omz - no worries. The MIDI file playback support should still be quite useful. If there is a way to install or supply your own soundbank via soundfonts it would be even more interesting.

zencuke

@omz thanks for the update. As usual I'm just waiting to get BLE. It sounds like there is a lot of work left to get a release done so I shouldn't expect anything soon. Should I switch to the updated snapshot? Someone said In a different thread that there was a 1.6 snapshot but I haven't tried it. Will that give me back Pythonista BLE?

ccc

@omz Awesome as always! Congratulations and good luck in your efforts with TestFlight and App IDs.

Above you wrote: You can also try downgrading by downloading 1.5 from the App Store.

That will only work for those who have not yet upgraded to iOS 8.3. On iOS 8.3 devices the workarounds that you mention above should allow folks downgrade from Pythonista v1.6 beta to v1.5 without losing their existing scripts.

Gerzer

Wow, this is freaking amazing. Tabs in the editor?! Drag-and-drop scene builder??!! iOS 8 extension???!!!!! I don’t know what to say. I personally don’t really care how long it takes for a new beta, it’s already obvious the wait will be well worth it. I don’t know about anyone else, but I say @omz take your time and do whatever is needed because what you’ve just shown us is fantastic beyond words.

PK

When will release 1.6 on App Store?
Function wonderful, I want out of use, but suffer from the beta is not desirable.

zencuke

&Omz I vote with @gerzer. The beta is really to help you by letting us help test. The goal is your standard high quality release. Only work on the beta if it helps you get there.

athros216

omz: Beautiful work! I can't wait to play with it, it looks pretty amazing!

tomkirn

Hi omz,

Option 1 to get my data out of the device isn't working. With iOS 8.3 and Xcode 6.3.1 I got following error:

mobile_house_arrest[5688] : handle_vending: Only containers for xcode-installed apps (apps with validated profiles) can be queried

wradcliffe

Could someone on this list please clarify how the downgrade from 1.6 beta to 1.5 is accomplished specifically? Going to the AppStore and selecting Pythonista only shows the "Open" option and not "Update". TestFlight only shows an option to Unsubscribe. What's the trick to getting an "Update" to 1.5 accomplished?

ccc

@wradcliffe, You have done the iOS upgrade to v8.3? If so, then the App Store downgrade is not longer an option for you. Look at the last paragraph om OMZ's post at the very top of this thread for options.

polymerchm

@OMZ: I "downgraded" before 8.3 so I lost nothing. the xcode trick does not wok in that situaton. I will try the DropBox solution.

omz

I've made some progress... A new beta should be up on TestFlight now. As I've mentioned in the release notes, it is NOT possible to install it on top of the App Store version, and I recommend that you make a backup of your files first and delete the old version before starting the download. I've made a simple backup script in case you don't have your own way of doing this: PythonistaBackup.py

Here are the release notes (also contained in the app):

New Features

  • Refreshed look and feel with new and improved color themes, refined toolbar icons, additional editor font choices, and a new app icon.

Selecting a different theme in the settings changes the look of the app much more profoundly than before, especially with one of the new dark themes.

  • App extension + appex module: This is basically a mini version of Pythonista that you can use in many system and third-party apps via the standard iOS share sheet. With the appex module, you can get the data that was passed to the share sheet (e.g. text, images, URLs) and use it in your scripts. The extension contains a basic editor (not all features of the main app, but good enough for minor changes) and an interactive console for ad-hoc experimentation. Please note that if you want to make a script (or other file) accessible from the app extension, it has to be in the special Extension folder. There are a couple of templates for extension scripts and the Extension folder also contains a few sample scripts by default.

  • Tabbed editor: You can now have multiple files open at once and quickly switch between them. On the iPad, there's a traditional tab bar interface (only shown when there are at least two tabs), on the iPhone, tabs are shown in a thumbnail grid when you tap the "tabs" button in the toolbar. If you have an iPhone 6 or 6 Plus, there's an option in the settings to use a tab bar instead (this doesn't work well on smaller screens, so the option isn't available on other iPhones or the iPod touch).

  • Significantly improved support for non-Python files: All files are now opened in a tab, so that all types of files can be renamed (it's also possible to change the file extension for all file types, which can be useful e.g. if you want to view a .pyui file as text). Apart from that, you can show a QuickLook preview for lots of files, open them in another app, extract zip archives, and play audio files.

  • The editor has basic syntax highlighting support for HTML, CSS, JavaScript (useful for bottle, Flask etc.), Markdown (which you see right now), and TaskPaper (if you want to keep a todo list next to your script).

  • New sk (SpriteKit) module: This is basically a wrapper around Apple's SpriteKit framework for creating 2D games. The API is very close to the original, but function names are often shorter than the 'original' (making it less tedious to write code with the on-screen keyboard) and I've simplified a couple of things to make it more suitable for short scripts (e.g. a few things that require setting up delegates in SpriteKit can be done by just overriding a method in sk.Scene).

While I don't plan to remove the scene module, this is intended to be a replacement for it, featuring significantly better performance, a more consistent, object-oriented API, support for advanced particle effects, filters, custom shaders and more.

There's also a new visual editor for setting up scenes without writing code. Like with the UI editor, these files are just JSON under the hood (you can rename a .pysk file to .json or .txt if you like). The sk.load() function for loading these scenes doesn't do any magic, and it's actually written in pure Python. While the scene editor doesn't do anything you couldn't do in code, it can often be easier to set things up when you see the results directly, especially for particle systems (sk.EmitterNode).

  • Commands in the console are syntax-highlighted now. The history UI has also changed a little and works better with Bluetooth keyboards (up/down arrow keys), and the code completion is a little smarter about when to add a space after you select a suggestion.

  • New setting to show the standard library in the file browser (you can't edit these files, but it can be quite interesting to read the source code nevertheless)

  • New "traceback navigator": When an exception occurs, you can tap on the error marker in the title bar to view the traceback in a much more readable format than before. You can also tap on individual lines to view them in the editor (even if they're in different files)

  • Improved sharing in the editor and file browser – instead of the custom 'Actions' menu, the editor now uses the standard iOS share sheet. You can still add custom scripts to this sheet in the settings (Editor Actions). You can also invoke a share sheet in the file browser (Edit mode), and customize this sheet via the File Actions setting. This is useful for scripts that operate on a list of files (e.g. to create a zip archive, upload them somewhere...) because the selected files are passed to the script (as part of sys.argv) automatically.

  • Improved asset/color picker and new built-in images and sound effects for games (mostly Public Domain, thanks to Kenney)

  • Improved in-editor search, including find/replace (currently only on iPad)

  • New setting to use "true" division in the console (this is basically equivalent to from __future__ import division in a script, you might want to turn this on if you often use the console as a calculator)

  • New setting for using a more compact keyboard (one row instead of two, iPad only)

  • New Indent/dedent menu items in the editor (copy/paste menu) – note: dedenting currently doesn't work very well if you use soft tabs/spaces

  • New "Highlight all" menu item in the editor (copy/paste menu) – this can be very useful for highlighting all occurrences of a variable/function name etc.

  • Improved "new file" menu with more templates and the ability to import photos and other saved images from the camera roll

  • New sound.MIDIPlayer class (plus midiutil module, currently both undocumented, but there's a "Random MIDI Melody" sample script)

  • Color and image previews in the code editor (when the cursor is inside a string that contains a built-in image asset name or a hex color, a preview is shown as an overlay)

  • Lots of new sample code (now contained in a dedicated Examples folder, so you have more room for your own scripts in the main library folder) – I've also made some minor changes to existing sample scripts. A lot of this is still very much work-in-progress (especially the larger sk examples "Platformer Game", "Word Game").

Notes and Known Issues

  • iOS 8.0 or later is required now

  • This version is built as a 64-bit app. Not only is this a requirement for submitting to the App Store very soon (starting in June), but app extensions require a 64-bit slice to work at all. Hopefully you won't notice this much, but it's possible that there are bugs related to this that I haven't caught yet. Unfortunately, as I've already discussed in the forum, this also means that a few things in the ctypes module cause crashes. I still haven't found a way around this, but all the ctypes-related sample code I've shared so far continues to work in this version.

  • Built-in images and sounds are currently not available in the app extension

  • The editor and console sometimes don't adjust their sizes correctly after the keyboard is hidden

  • The title of the editor and the error indicator are often positioned incorrectly after a view without status bar (e.g. an sk.View) was presented

  • The 'sidebar' presentation style (ui module) is currently not supported

  • The dialogs.import/export_file functions (from previous betas) are not available in this build (might come back, but I can't promise anything right now)

  • The console currently doesn't have its own Run button

  • Renaming a file that is open in multiple tabs may result in duplicates

  • On iOS 8.3, the extended keyboard doesn't respond to touches if they occur too quickly after a regular key was pressed. This appears to be an intentional change by Apple (probably to avoid mistakes when typing quickly), and it doesn't look like there's anything I can do about it.

  • Automatic indentation doesn't work in some cases (e.g. when splitting a line)

  • Cmd+left/right-arrow (Bluetooth keyboard) doesn't work correctly in some cases (workaround: press the arrow key without Cmd once before using the shortcut)

  • When selecting from the outline popup the editor sometimes scrolls too far

  • Selecting text in non-editable (i.e. standard library) files doesn't work very well

  • The new color picker doesn't support alpha values yet

  • Setting the target_node attribute of an sk.EmitterNode can lead to crashes (usually not immediately because this happens during garbage collection)

  • The keyboard is sometimes dismissed when it shouldn't be (usually after a popover is dismissed when any kind of modal view was presented before)

  • The documentation is incomplete (especially for the new sk module)

  • The modal and stop_when_done parameters for webbrowser.open() are currently ignored

  • The zoom setting in the sk scene editor doesn't work very well

  • Changing the editor font size can be slow

Cethric

It is looking amazing @omz, keep up the great work.

What do I need to do or what should I do to get access to the Test Flight Beta Version.

briarfox

@omz You have been busy! Thank you for your continued support in pythonista, Please give us a way to donate to you or an optional in app. With as much time that I have spent in pythonista, I feel guilty buying the app on sale and would like to support your continued development.

Looking forward to playing with the new beta!

dgelessus

Installing the new beta was... fun. I still had the previous "dead" beta version installed, so I tried updating that directly, as all the warnings were just about the app store version and said nothing about the old beta. It never got past the start of the installation process though. I wasn't allowed to delete the app from the home screen anymore, and cancelling the installation from TestFlight didn't do anything either, so I deleted Pythonista from the "Usage" section of the system preferences.

After doing that the app was in some odd state where it was at the same time installed, downloading, and not usable in any way. After a few reboots and cancelled installations I installed the app store version, deleting my data, then uninstalled that, and then I installed the new beta again. The install process again took forever, but I just let it run, and now I have a running Pythonista again. Now I need to figure out how to pack my backup data into an archive that stash can actually read...

Anyway, I've done some experimenting without my previous data, so here's my usual feedback list:

General UI:

  • Editor and console tabs are great to have. It would be nice though to have an "Open in New Tab" option for links in webbrowser and documentation tabs.
  • I personally like to be able to close the last open tab, even if it just opens a new blank tab in its place. An option to always show the tab bar would be nice.
  • The new file creation dialog is nice. Could that kind of collapsible folder list also be used for the move menu?
  • Custom templates for the file creation menu?
  • Where exactly are the "File Actions" meant to appear?
  • The IDLE theme is gone :(

Editor/Console:

  • Hard tab width only works correctly for Menlo on size 15.
  • Block indent/dedent (from selection popup menu) always uses hard tabs, even if soft tabs are enabled.
  • Auto-pairing characters cannot be disabled. (They also don't work well with triple-quoted strings, though that isn't the main reason why I keep them disabled.)
  • The option to not "reset" the global environment is gone. I got used to having a number of modules and functions always in my globals for interactive use, and there are many cases where it's useful to keep the globals between script runs for convenience.
  • The Cmd+J shortcut to switch between editor and console is gone.
daniel777

@omz Thanks for your excellent work! Yet I just have a question: Is it possible to import/export files regardless of their types from/to other apps in the new version?

briarfox

@omz How do you close pythonista when ran in safari? The x is grayed out for me and I have to clear safari from memory to remove the pythonista popup.

henryiii

On the new scenekit, I haven't been able to get gravity to work. I tried to modify the Physics Clock demo to add gravity from motion, but using self.physics_gravity = motion.get_gravity()[:2] doesn't seem to work; in fact self.physics_gravity = (5,-5) or something similar does not work either. Numbers still fall straight down. Am I missing something?

zencuke

@omz Thanks for the new beta. Lots of fun toys to play with.

I haven't run any of my code yet (figuring out how to restore from dropbox when my sync script is only on dropbox ;-) but here are some issues running through the examples. I'm running on iPhone.

1) CB isn't mentioned in the release notes. I hope it is still there. I see it in the doc so it probably is.

2) I can't figure out how to add an image. The file menu (now under "+" instead of the select menu) doesn't seem to have the user image choice with the "add" button anymore.

3) There used to be a png file in the files menu but it went away. Did I delete this by accident or was this a bug? I don't know how to delete things in the files menu. It is not in the trash. I hope it wasn't needed for an example or something. Now the files menu seems pretty useless. Nothing to select, no obvious add functionality. It seems like some user interface element is missing.

4) Random MIDI example doesn't work. The home screen pops up and no sound happens. The Pythionista app is still there but seems to have restarted because the editor state (open files) reverts to an older state.

zencuke

@omz Low priority issue: I had never heard of a share sheet until I saw the comment in the release notes. I'll figure it out with Google's help but it might be worth updating the doc on editor/file actions for users who might not know about the functionality.

wradcliffe

@omz - I was able to install over the previous beta with no issues or loss of data. The install took quite some time on my iPad4 - probably 10 minutes. I was beginning to think it had hung. Nothing like the issues @dgelessus was having.

omz

@briarfox

How do you close pythonista when ran in safari? The x is grayed out for me and I have to clear safari from memory to remove the pythonista popup.

The x is for stopping scripts (grayed out if nothing is running), tap Done to close the extension. If the console output is visible, swipe right first (a Done button in the console will probably be in one of the next builds)

Saturn031000

I was able to update from the previous beta without a loss of data as well.

dgelessus

Maybe I was just impatient then, the long wait at the start of the update made me think that something was wrong. My attempts to cancel the installation probably just made things worse.

zencuke

@dgelessus I loaded the beta last night. After backing out to 1.5. It took a long time (hours) but it eventually worked. It failed once so I just restarted. I assume the problem was with testflight and moving in and out of wifi range, unrelated to Pythonista. I've had similar issues with testflight before. I don't think testflight is very robust and it is certainly slow. It used to be worse.

polymerchm

The midi example crashes on my iPad 2 air. Kills the interpretor w/oany tracebeck when executing the line player = sound.MIDIPlayer('output.mid')

polymerchm

Midi file is there 144 bytes and is recognized by external midi programs.

polymerchm

Major weirdness

Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Application/9C6CA438-893C-4AD6-BB3C-62437E69416C/Documents/chordcalc/chordCalc/Spinner.py", line 188, in <module>
    spinner1.position = (110,150)
  File "/var/mobile/Containers/Data/Application/9C6CA438-893C-4AD6-BB3C-62437E69416C/Documents/chordcalc/chordCalc/Spinner.py", line 110, in position
    self.frame = value + tuple(self.frame[2:])
TypeError: sequence index must be integer, not 'slice'
polymerchm

Seems ui.View.frame object is now type Rect and not a list. Need to read the new ui docs.

ccc

There was a new version of TestFlight released a few daze after the Beta. Perhaps that new TF release helped with the issue of installing of one beta on top of another.

dgelessus

@polymerchm, try converting to a tuple before slicing: tuple(self.frame)[2:]

@ccc, if I were to guess TestFlight is only the front-end to the beta app system, similar to the App Store app. Both of those don't actually need to be running during the installation of apps, they are just necessary to start the installation. I'd imagine that TestFlight gets the app package from somewhere else, but installs it like any normal app, so I doubt the TestFlight update would have any direct effect on the installation process.

omz

Regarding the MIDIPlayer crash: I made a last-minute change there that I didn't test properly. Here's a quick workaround – just replace the last two lines with this:

import os
soundbank_path = os.path.abspath(os.path.join(os.__file__, '../../merlin_silver.sf2'))
player = sound.MIDIPlayer('output.mid', soundbank_path)
player.play()
dgelessus

Here's another missing feature: changing the console font and size. Is it just me, or are the default fonts in the new beta larger than they used to be?

PS:

Found a bug in the ui module - an ui.ScrollView's bounds attribute is a ui.Rect, but expects a tuple when setting. For example, this code will fail:

import ui
sv = ui.ScrollView()
sv.bounds = sv.bounds

"""
Traceback (most recent call last):
  File "<string>", line 3, in <module>
TypeError: Expected a tuple
"""
wradcliffe

@omz - as @zencuke indicates - the Random MIDI example fails. Pythonista seems to just restart when you run it. The output.mid file is generated.

omz

@wradcliffe I know, have you tried the workaround I suggested?

zencuke

@omz The workaround worked for me. Thanks.

omz

@henryiii

On the new scenekit, I haven't been able to get gravity to work. I tried to modify the Physics Clock demo to add gravity from motion, but using self.physicsgravity = motion.getgravity()[:2] doesn't seem to work; in fact self.physics_gravity = (5,-5) or something similar does not work either. Numbers still fall straight down. Am I missing something?

Not sure why this doesn't work for you, here's a slightly modified PhysicsClock script that uses motion data for changing the gravity:

→ PhysicsClock.py (Gist)

wradcliffe

@omz - yes the workaround fixes the problem. It also shows how to select the soundfont! Thanks!

JonB

Not sure if a new thread is in order... But here are a few observations about the new beta...

  • in general ... Wow! Looking amazing.
  • console: I thought in the old pythonista, there was a way to quickly clear the current input line. For instance, when you press the up arrow for history, pressing down repeatedly should bring you back to an empty line. This sometimes works in the beta, but only if you had previously typed an empty line!
  • console history: I admit I liked the history that popped up partial completions. Arrows are nice too, but there were times when a histiry popup was nice.
  • console: raw_input should give some indication that console is in input mode? I can't remember what 1.5 did, but I thought something changed.
  • thank you for sound.Player.finished_handler! Should the MIDIPlayer have something similar?
  • ui.Point, and ui.Size, etc are nice... however it seems like they should be tuple-like since some functions require tuples. For backwards compatibility, seems like slicing would need to be implemented. Then again, I guess adding tuples and adding vectors are very different operations, so maybe forcing people to cast as tuples if they want to slice is a reasonable compromise.
  • several ui functions or properties, like ui.convert_point, content_offset, frame, bounds expect a tuple, yet return Point or Rects.
  • bug: globals are cleared on run from editor, even if that setting is off. Running from action menu doesn't clear globals. This was breaking stash, and other Views run in panels, when suddenly imported modules were no longer in globals.
  • I like the traceback browser, and it's ability to open files, however it seems like some errors are caught by the traceback without giving any indication to the user that there was an error. In 1.5 I think the editor or console would swipe into view when errors occurred. That could sometimes be annoying, and in certain cases made it hard to debug/stop a View... but we do need some indication of an error when in Views. Perhaps popover the traceback thingie onto the current view?
  • getkbframe and convert point now work in fullscreen.
  • still a problem - cannot use custom touch methods in a View presented as a panel, because the panel wants to slide to editor, and steals the touch events. Perhaps disable this feature when a View has touch handlers, and only slide using the top bar area?
  • i like the ability to have more than one tabbed ui.View/Doc/webbrowser... but without View.close(), things get cluttered quickly. Is there a way to programatically define whether a View gets its own tab, or reuses an existing slot? Or a way to close tabs programatically? For instance, I'm thinking if two views have the same title, presenting the second view should not create a new tab. That way, generic untitled views always go to the same spot, while utilities can stay open.
  • I understand editor actions.... But what are file actions, and how do I use them? Maybe I'm missing where the file action menu lives?
  • is there a pythonista version number accessible via sysconfig or somewhere else? That could be useful for writing backwards compatible code, though I realize we can try importing some of the new modules.
JonB

Also.. Does the platform game example work for anyone? I'm on ipad2, and I just get a gray screen.

Moe

@JonB I wanted to report that as well. Gray screen, but the sound plays.
iPad mini 2, iOS 8.1.

tomkirn

Example "Random MIDI Melody.py" will close Pythonista immediate after start. Anyone seeing this behaviour as well? (iPad Air 2).
Edit: There is even no output.mid file created

ccc

Running pythonista_module_versions.py throws InsecurePlatformWarning exceptions on bottle (still not current with pypi) and bs4 and then halts on cffi because that module is no longer included in Pythonista.

briarfox

@JonB #Moe I get the grey screen as well on the platformer example. iPad Air.

ccc

I also added:

modules += '''appex cb ctypes dialogs sk'''.split()  # modules added in Pythonista v1.6 Beta

to pythonista_undocumented.py but I also opened a new issue because I now realize that pythonista_undocumented is doing an incomplete job by overlooking class methods. Any pull requests to close that issue would be gratefully accepted.

mncfre

@omz excellent changes, this is a major release thanks, please if it's possible add:
- line numbers on iPhone 6/6+
- Ability to set or get from the clipboard any object, not only text and images.

It would be really helpful!!!

zencuke

@tomkirn see midi discussion and @omz workaround earlier in this thread.

JonB

@dgelessus

Where exactly are the "File Actions" meant to appear?

I had this same question. In the built in file browser, when you hit "edit" such as to move or delete groups of files, there is a new "share" icon, which now shows custom actions underneath.

zencuke

On an iPhone 6 in the editor screen when you tap "+" in the top bar a view appears which has a "Files" Menu choice (It shows in the images and sounds tabs.) What is this for? When I select it I see an empty view. I think there was an image in it right after I installed the beta but it is gone now. All of the visible icons when tapped change the view. There is apparently no functionality in this view. There is a search control in the top bar but it doesn't seem to do anything.

Side note: I'm curious what this view looks like on an iPad.

zencuke

On iPhone 6 in the file edit view if the keyboard is not displayed the "+" icon doesn't do anything.

omz

The Files section is supposed to show image and sound files in the folder of the current script (and subfolders). If there aren't any, it might be empty (though the whole section is actually supposed to be hidden then ... it looks like this isn't working properly right now).

zencuke

This might not qualify as a bug but on the iPhone 6 in edit file view the gesture to make the keyboard go away is quite touchy to figure out. There is no longer an icon to make the keyboard go away. Apparently now you need to drag it down. However it is not clear what exactly needs to be dragged. Trying to drag the keyboard itself generally types something wiping out what is selected. (BTW: Thanks for undo now that I found it again.) Starting a drag in the content area usually works but is sometimes interpreted as a select or scroll. The old keyboard icon took valuable space but it was nice and reliable. Tap and the keyboard is gone.

Also the animation is unexpected. First the keyboard reduces to a single line (the top line) then after a short pause that line goes away.

bvwelch

Greetings,

The cb module , and your heart-rate monitor example is working great with the Wahoo TICKR heart monitor strap! Thank you!

William

Gcarver166

Bug: I was adjusting the order of editor actions, moving the default ones to the bottom of the list. Suddenly only the last script in my list was available . I removed and readded mine (about 6) but still only the last one is available for selection. They still show up in the editor action list in settings though.

Gcarver166

Still a bug: In one of my editor scripts I still get a row_height of -1 from a TableView. Now it actually seems to never be set. I'm manually setting it during init at the moment. I checked the value in did_load() and layout(). Btw my editor script presents a view. I get a -1 if run directly as well. I have reported this in previous versions of 1.6. The height worked in 1.5 but other issues prevented this script from working before.

Gcarver166

I really think sk.Scene.update() should take a delta time parameter instead of assuming 16ms.

wradcliffe

FYI - the new 1.6 beta gives back access to the Documents folder for programs like iFunbox and iExplorer.

JonB

perhaps not a "bug", but at least a source of incompatibility with some libraries: StdInCatcher/StdOutCatcher don't implement isatty(). This breaks some libraries.

blmacbeth

Bug (maybe): I have been playing around with SpriteKit and doing some physics stuff. I noticed, though that the physics numeric attributes are not working (density, friction, restitution, linear dampening, etc). I am making a game that needs a bouncy ball and no matter how I tweak the restitution of the object, it doesn't seem to get any bouncier.

Note: I have also tried tweaking other attributes in case restitution was not the thing I needed and none of them seemed to make it bouncy.

JonB

Restitution worked in the physics clock example. I adjusted the default (0.25) to differnt values. Setting it to 1.0 makes the numbers basically jump all the way back to where they started. Setting it to 2.0 made them shoot wildly across the screen. Setting to zero results in no bounce.

Perhaps you are changing it in the wrong place -- check out the physics clock in your examples folder (you might need to restore examples from the options menu)

zencuke

Adding to the list. Platformer Game doesn't seem to work in iPhone 6. Display goes grey but nothing happens. After taping the screen music starts. Various gestures cause quick sound effects but the screen stays empty. Based on earlier reports in this thread this doesn't seem to be platform specific.

zencuke

Is it possible in the beta to create image files from the clipboard. In 1.5 this functionality was available from the select/insert menu but I can't find it in the beta.

dgelessus

Am I the only one who is actually able to play the platformer game? I'm on an iPad mini (the old one) with iOS 8.3.

Knewbee

Platformer game works for me. (iPhone 5S and iPad mini Retina, both running 8.3)

polymerchm

Works on my iPad 2 Air and iPhone 6.

blmacbeth

@JonB thanks for pointing that out. I played around with the Physics Clock and it did everything you said it would. I think that my problem comes from the sprite kit editor. If you set the physics from the editor (not programmatically) then it keeps the defaults that where in the editor. I can fix this by manually changing them from the program.

@omz the bug is that the default physics attributes from the sprite kit editor don't change if you change them from the editor.

123npszjhl

Will Pythonista support pyd pyo pyx etc. in the future? Many useful modules require these formats.

dgelessus

pyd files are dynamic libraries. As far as I know they don't have a specific format - on Windows for example they are just dlls with a different extension, on other operating systems that's probably also the case. This means that most pyds would not be compatible with the iOS kernel in the first place and would need to be recompiled from source code. Because Apple doesn't allow apps to dynamically link to custom libraries it wouldn't be possible to use those anyway.

pyo files are optimized Python bytecode. (Optimized means that any assert statements, and sometimes docstrings, have been removed.) Their format is the same as for pyc files, which Pythonista already generates to improve module loading speed. These files are usable in Pythonista - IIRC someone has done this before - but there's little point in doing that, you might just as well use the Python source code for the files.

pyx files are Pyrex or Cython code. Both are languages that are syntactically similar to Python, but compile to C source code and can use C types and libraries. The problems with these are the same as with pyds that I explained above.

zencuke

I upgraded my iPhone 6 to iOS 8.3 and Platformer game works now. Unfortunately I don't remember the iOS version that failed.

polymerchm

I am getting a repeatable crash of pythonista 1.6 when editing a meduim sized file. It comes when I type anything after I type the instace of a tableview and then the period. I beleive this is an autocompletion issue. But I can't figure out how to disable autocompletion to test it.

dgelessus

Does clearing the code completion cache change anything? If not, mind uploading the code in question to Gist? Interestingly I don't get any code completion at all for a TableView instance.

AFAICT it isn't possible to disable code completion (or switch it to "simple" mode) anymore in the latest beta. There isn't even an option for that in the com.omz-software.Pythonista.plist file anymore.

JonB

I do get TableView instances to code complete, though the first time takes a few seconds.
I have observed requests objects, and Gittle objects take a really really long time to complete(like minutes....I think the innards of these are very dynamic) in 1.5, which locked everything up until a completion popped up! The workaround was to type a space, then period followed by your attribute, then go back as backspace out the space. This prevents autocomplete from happening, at least in the console. Misspelling the object name also works,etc.

JonB

Blmacbeth, where are you setting the physics? Make sure you are setting it AFTER calling sk.load, otherwise load overwrites anything you have set already.

polymerchm

I've uploaded pyuiEdit as a repo here. The offending code is in the script walker.py at line 312.

Gcarver166

node.copy() does not copy the physics body correctly. The node copy points to a physics body but I think it's the same as the original. I have to manually make a copy.

polymerchm

More on autocompletion explosions. I opening up chordcalc.py and typed

tvCapos.delegate = fred

When I went to the file menu to switch files, the app crashed.

JonB

Re: platformer grey screen. I found on IOS 8.2 that removing the [`orientations='landscape'] from the last line, then rotating my device after pressing play, the game was playable.

polymerchm

It's fine in 8.3.

blmacbeth

@JonB, I am setting up the physics through the sprite kit editor, not through the script editor. The first thing I do in the script is things = sk.load('things.pysk, sk.Node()). I would assume that the numbers I set in things.pysk would load there. However, when I run the following: (where I have set restitution in things.pysk to 0.5 )

ball = things['ball']
print ball.physics_body.restitution

I get 0.2 and not 0.5. I found a work around by setting the restitution in the script editor.

polymerchm

Hooked up to my Mac and used XCODE to look for a crash report. None.

dgelessus

(Thought I had posted this before...)

I manually imported jedi and tried to get a code completion on one of the problematic spots. At some point it ends up in an infinite recursion loop, until the interpreter throws an exception due to exceeding the recursion limit. Why exactly this happens I can't say though.

polymerchm

An off switch would be nice. This was not a problem (in 1.5). @degelessus: Which version of jedi did you try? The installed jedi in 1.6 is 0.9.0. Perhaps a rollback to 0.8.1?

mteep

@polymerchm It seems that only crash reports with file names ending in ".ips" are shown in Xcode. Those that have been transferred are renamed on the device to ".ips-transferred" or similar. Those from the Pythonista beta end in ".ips-beta" or so. Fortunately, they call all be viewed on the device, if you go to Settings -> Privacy -> Diagnosis ... -> Diagnosis ... (or something close to that).

polymerchm

@OMZ Do you automatically get crash logs, or can I send them to you? Will sync device tonight and see if I have logs relevant to the autocomplete bug (now that I know where to find them).

Omega0

I've found an issue where editor.make_new_file() causes the app to crash. It doesn't seem to matter what arguments I pass to it the app just shuts down.

polymerchm

works fine for me (iOS 8.3, beta 1.6).

import editor

editor.make_new_file('test.py','this is a test')

create a file in the root directory each time its run, adding a number to the end to avoid a duplicate name.

Tizzy

I love the updates!!! especially tabs and search. Also love the purplish theme. And most of all love the improved traceback readout. And the consolidated keyboard is a great idea.

Great job OMZ you've created the premier development platform for (on) iOS!

Just an observation - the yellow dot to the left of "Pythonista" under the icon doesn't go away for me. I believe it's supposed to indicate that there's a new version of the app on your device that you haven't opened yet...but I have. Pythonista is the only app I have in test flight so forgive me if I'm wrong - either way sounds like it would be a test flight issue.

Also one gripe - if you have a script in the foreground and it runs, you can click the x in the upper right while in console view to stop it. You can't press play(run) from the same place - instead it's a greyed out x and you have to backup to the script to press play again. It wasn't like this in previous versions, and while I can see the logic in making sure you're at the script before you can run it, being able to run a script multiple times while looking at the console without backing out of it is very useful to quickly try code modifications out during development...for me at least. Perhaps a toggle for this functionality deserves to exist in settings?

Thanks again.

ALSO, since the new version I get this error all the time. Everything still works, but this error shows up in red in the console.

D96-4218-87C0-D09DA5054558/Pythonista2.app/pylib/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
ccc

I believe the yellow dot means the app is in testing/beta state.

The lack of a run button on the console is explained in the Beta readme and/or in a post above.

The insecure platform thing is tied to new security checks in the requests module.

misha_turnbull

Just another bug report (maybe it's just me doing everything wrong) for the sk module:

Here is the code I'm using:

# coding: utf-8

import sk
import random

MAXSPD = 700
MAXLIFE = 15
TEXTURE = 'shp:Circle'
MINLIFED = -350
MAXLIFED = 350
SCALE = 2

decayrate = 0.005
collider_f = 0.35

def randvec(maxspd):
    return (random.randint(-maxspd, maxspd), random.randint(-maxspd, maxspd))

particle_tpl = sk.SpriteNode(sk.Texture(TEXTURE))
particle_tpl.name = 'particle'
particle_tpl.color_blend_factor = 1
particle_tpl.age = 0
particle_tpl.lighting_bit_mask = 1
particle_tpl.x_scale = SCALE
particle_tpl.y_scale = SCALE
particle_tpl.alpha = 0.5
particle_tpl.shadow_cast_bit_mask = 1
physics = sk.PhysicsBody.circle(particle_tpl.size.x/2 * collider_f)
physics.restitution = 1.2
physics.affected_by_gravity = False
physics.allows_rotation = True
physics.mass = 2
physics.pinned = False
physics.angular_velocity = 0
physics.category_bit_mask = 1
physics.contact_test_bit_mask = 1
particle_tpl.physics_body = physics

class Game (sk.Scene):
    def __init__(self):
        sk.Scene.__init__(self)
        self.name = 'scene'
        self.particles = set()
        self.img = sk.Texture(TEXTURE)
        self.maxspd = MAXSPD
        self.handles_node_touches = False
        self.maxlife = MAXLIFE * 60  # convert to frames
        self.selected = None

        # init walls
        for y in [768, 0]:
            wall = sk.Node()
            wall.position = (512, y)
            physics = sk.PhysicsBody.rect(1024, 100)
            physics.affected_by_gravity = False
            physics.allows_rotation = False
            physics.restitution = 1.2
            physics.pinned = True
            wall.physics_body = physics
            self.add_child(wall)

        for x in [0, 1024]:
            wall = sk.Node()
            wall.position = (x, 384)
            physics = sk.PhysicsBody.rect(100, 768)
            physics.affected_by_gravity = False
            physics.allows_rotation = False
            physics.restitution = 1.2
            physics.pinned = True
            wall.physics_body = physics
            self.add_child(wall)

        # lighting
        light = sk.LightNode()
        light.position = (10, 758)
        light.shadow_color = (1, 0, 0)
        light.ambient_color = (0, 0, 1)
        light.light_color = (0, 1, 0)
        light.enabled = True
        light.category_bit_mask = 1
        light.alpha = 1
        light.falloff = 0.4
        light.name = 'light'
        self.add_child(light)

    def update(self):
        for p in self['particle']:
            p.age += 1
            if p.age >= p.lifespan:
                # if exceeded life, reduce alpha by 1
                p.alpha -= decayrate
                if p.alpha <= 0:
                    p.run_action(sk.Action.call(p.remove_from_parent))

    def touch_began(self, node, touch):
        self.selected = None
        new = particle_tpl.__copy__()
        new.position = touch.location
        new.physics_body.velocity = randvec(MAXSPD)
        new.color = (random.random(), random.random(), random.random())
        new.lifespan = self.maxlife + random.randint(MINLIFED, MAXLIFED)
        #new.z_position = random.randint(0, len(self.get_children_with_name('particle')))
        self.add_child(new)

    def touch_moved(self, node, touch):
        self.touch_began(node, touch)

    def did_begin_contact(self, collison):
        # Make the color change on collison
        collison.body_a.node.color = (random.random(), random.random(), random.random())
        collison.body_b.node.color = (random.random(), random.random(), random.random())

def main():
    game = Game()
    scene_view = sk.View(game)
    scene_view.shows_fps = True
    scene_view.shows_node_count = True
    scene_view.present()
    return game

if __name__ == '__main__':
    g = main()

It's similar to the old Particles example, however using physics. I'm running into two problems:

  1. No matter what I do, I can't make the sk.LightNode() do anything.
  2. In did_begin_contact, I'm getting the following error:
AttributeError: 'NoneType' has no attribute 'color'

It says in the docs that the collison.body_a.node attribute should be the node it is attached to, but for me it seems to be just None.

omz

@misha_turnbull It looks like both issues are caused by bugs in sk.Node.__copy__. Try setting the lighting_bit_mask attribute manually after creating the copy. To make the contact callback work properly, you'd probably need to create a new PhysicsBody instead of relying on the one that gets copied along with the node. I'm looking into this. One other thing: If you want to make your physics bodies "immovable", set dynamic to False instead of pinned to True.

techteej

I must say, after being out of the Python world for a while, this makes me very excited to get back in!!

mteep

@omz There seems to be some issue affecting the canvas module. In both the recent betas (160013 and 160014), your turtle.py example crashes Pythonista immediately. But other simple canvas usage does not. In released versions like 1.5, and the earlier betas, I have only observed canvas crashes when I edited the script while it was running.

ccc

https://github.com/cclauss/pythonista-module-versions is still throwing warnings on requests calls in 160014.

omz

@ccc I mentioned in the release notes why I rolled back to an older version of requests.

ccc

I read that but Pythonista_module_versions.py is still throwing warnings like it would if you did NOT roll back the version of requests.

Requests is indeed fairly current according to Pythonista_module_versions.py:

| module        | local    | PyPI       |
| name          | version  | version    |
| ------------- | -------- | ---------- |
| requests      | 2.6.0    | 2.6.2      |
omz

Hmm, looks like something went wrong in my deployment script, should be 2.5.1.

dgelessus

This has been a problem for a looong time, but I never got around to reporting it: in the interpreter input field you cannot use the tab key on an external keyboard. It probably tries to switch to the next input field instead, which does nothing, because there is no other input field.

polymerchm

P.S. No Watch folder. Not that I am buying a watch. I did the Testflight install over the previous beta, not fresh.

Gcarver166

misha,
regarding your issue.
new = particle_tpl.copy() #does not correctly copy the physics body.
new.physics_body = particle_tpl.physics_body.copy() #should fix your problem.

MartinPacker

By the way if I have zero scripts is there any reason not to try the beta? I assume any I do create while using the beta might need rescuing by cut and paste (or whatever).

omz

@polymerchm Are you running Pythonista on an iPhone? The Watch folder is not created on iPad because the watch can't be paired with that anyway.

polymerchm

Gotcha. Haven't installed it on my iPhone yet. So far all else is good on this build. Thanks.

misha_turnbull

@omz, @Gcarver, I've managed to make the did_begin_contact work correctly by changing touch_began to this:

def touch_began(self, node, touch):
    new = particle_tpl.__copy__()
    new.physics_body = new.physics_body.__copy__()
    new.lighting_bit_mask = 1
    new.position = touch.location
    new.physics_body.velocity = randvec(MAXSPD)
    new.color = (random.random(), random.random(), random.random())
    new.lifespan = self.maxlife + random.randint(MINLIFED, MAXLIFED)
    self.add_child(new)

However, although this makes did_begin_contact work correctly, none of the particles are actually appearing. It seems that they have an alpha value of 0, however I know that this isn't true. The node count in the bottom corner tells me that they exist, but they just don't show up. I have tried changing the background color, but it made no difference.

JonB

Misha, your posted code works fine for me, are you sure you didn't make other changes?
Maybe try restarting pythonista?

If you also set
new.shadow_cast_bit_mask=1, then the shadows show up too.

Shadows on top of textures seem to be stuck as white, If I add a texture background.. Also, light falloff doesn't seem to affect shadows, which is strange

polymerchm

@OMZ Sorry to report the autocomplete bug is stll there. Seems to happen write after typing the "." after an instance of a class. Highly unreproducible.

omz

@polymerchm What kind of device are you using?

polymerchm

Ipad 2air with external Bluetooth keyboard

Gcarver166

Misha, try setting new.alpha = 1

misha_turnbull

@JonB here is the code I'm using now, have restarted Pythonista many times and can't think of any other changes I've made other than removing light.alpha = 1:

# coding: utf-8

import sk
import random

MAXSPD = 700
MAXLIFE = 10
TEXTURE = 'shp:Circle'
MINLIFED = -120
MAXLIFED = 120
SCALE = 2

decayrate = 0.005
collider_f = 0.3

def randvec(maxspd):
    return (random.randint(-maxspd, maxspd), random.randint(-maxspd, maxspd))

particle_tpl = sk.SpriteNode(sk.Texture(TEXTURE))
particle_tpl.name = 'particle'
particle_tpl.color_blend_factor = 1
particle_tpl.age = 0
particle_tpl.lighting_bit_mask = 1
particle_tpl.x_scale = SCALE
particle_tpl.y_scale = SCALE
particle_tpl.alpha = 1
particle_tpl.shadow_cast_bit_mask = 1
physics = sk.PhysicsBody.circle(particle_tpl.size.x/2 * collider_f)
physics.restitution = 1.2
physics.affected_by_gravity = False
physics.allows_rotation = True
physics.mass = 0.3
physics.pinned = False
physics.angular_velocity = 0
physics.category_bit_mask = 1
physics.contact_test_bit_mask = 1
particle_tpl.physics_body = physics

class Game (sk.Scene):
    def __init__(self):
        sk.Scene.__init__(self)
        self.name = 'scene'
        self.img = sk.Texture(TEXTURE)
        self.maxspd = MAXSPD
        self.handles_node_touches = False
        self.maxlife = MAXLIFE * 60  # convert to frames
        self.background_color = (0, 0, 0)
        self.lighting_bit_mask = 1

        # init walls
        walls = sk.Node()
        walls.position = (0, 0)
        physics = sk.PhysicsBody.edge_loop_rect(0, 0, 1024, 768)
        physics.dynamic = False
        physics.restitution = 1.1
        walls.physics_body = physics
        self.add_child(walls)

        # lighting
        light = sk.LightNode()
        light.position = (10, 758)
        light.shadow_color = (1, 0, 0)
        light.ambient_color = (0, 0, 1)
        light.light_color = (0, 1, 0)
        light.enabled = True
        light.category_bit_mask = 1
        light.falloff = 1
        light.name = 'light'
        self.add_child(light)

    def update(self):
        for p in self['particle']:
            p.age += 1
            if p.age >= p.lifespan:
                # if exceeded life, reduce alpha by 1
                p.alpha -= decayrate
                if p.alpha <= 0:
                    p.run_action(sk.Action.call(p.remove_from_parent))

    def touch_began(self, node, touch):
        self.selected = None
        new = particle_tpl.__copy__()
        new.physics_body = new.physics_body.__copy__()
        new.lighting_bit_mask = 1
        new.position = touch.location
        new.physics_body.velocity = randvec(MAXSPD)
        new.color = (random.random(), random.random(), random.random())
        new.lifespan = self.maxlife + random.randint(MINLIFED, MAXLIFED)
        new.alpha = 1
        self.add_child(new)

    def touch_moved(self, node, touch):
        self.touch_began(node, touch)

    def did_begin_contact(self, collison):
        if collison.body_a.node.name == 'particle' and collison.body_b.node.name == 'particle':
            collison.body_a.node.color = (random.random(), random.random(), random.random())
            collison.body_b.node.color = (random.random(), random.random(), random.random())

def main():
    game = Game()
    scene_view = sk.View(game)
    scene_view.shows_fps = True
    scene_view.shows_node_count = True
    scene_view.present()
    return game

if __name__ == '__main__':
    g = main()

However, it still just gives me a black screen. As before, when I touch the screen the node count goes up but I cannot see anything.

JonB

I can see the balls appear just fine with your code on ios 8.2 on ipad2. For the platformer game I had a similar problem which was solved by rotating the display. You might try running it, then rotating the device so that it tries to resize.

ccc

The code above works for me.

dgelessus

Not sure if this is a bug or an odd feature, but Pythonista strips all whitespace (including trailing newlines) from the end of a file when it is saved. This only becomes apparent when closing the editor tab for that file or restarting the app. If this is intentional, it would be nice if this were optional.

ccc

In the beta release ui.View().present(orientations=['landsacpe']) is not forcing the view to display in landscape mode. It is just me or are others seeing the same behavior?

Helgi

Can somebody among the beta users tell me whether the extensions can be made to handle files (e.g., Mail attachments) in a way that was possible with Open In?

The scenario I used in the days of Open In was this: I have an email attachment of specific type (e.g., .txt), I open it in Pythonista, the Open In handler then performs some automated actions (in my case, uploads it via SCP and then runs several commands on the remote server). Can this be done with the extensions now? Should I wait for the new release or try and find other ways to do this?

JonB

That's exactly what the extensions let you do.

Webmaster4o

How can I sign up for the test flight beta? I want to try it, looks AMAZING.

userista

Modules that are in site-packages are not importable when in the app extension. Is this expected behavior?

JonB

The extension runs in its own sandbox.. As I recall there was an extensions site packages? You have to separately install packages to both locations.