• dvader9

    Seeing a few new people join the forum and ask questions lately, I was thinking that it might be good to have someone write a quick intro to the forum, what some of the must-have tools, how to go about getting those setup on Pythonista, and how to increase your library from there. Pythonista-Tools is a great resource once you know how to use GitHub, but I could image there being a need for some extra instructions.

    I know some of the hardcore python coders and forum contributors will be best-placed to do so, and can point to best practice. But for example, some tools like gitrepo, New Script from Git, Dropbox File Picker, ui-tutorial, scene tutorial, stash, etc... would be good to include in such a document or post.

    So two things, I guess:

    1. Perhaps some of the newer forum members and Pythonista users can describe their learning curve, and suggest ways for the rest of this community to help, if it's needed at all.

    2. If there is a need, are there any volunteers to put something like that together?

    posted in Pythonista read more
  • dvader9

    Quick tip: one of the differences between the previous template and this latest one, is that the "Skip Install" flag in the Build settings is set to Yes. This means that when you create an App Archive for submitting to the store, it doesn't automatically export it to your Organizer Tool.

    I haven't gone through the whole pipeline with this project template yet: script in Pythonista on the iDevice -> porting script to Xcode -> debugging in Xcode -> submitting to store -> distributing on store; it's not a priority for me at this point, but I have been playing with some of the settings. You've given us a good tool, @omz, to learn Xcode at a very superficial level, thanks. Anybody gone through the whole pipeline yet?

    posted in Pythonista read more
  • dvader9

    Are you sure your server accepts TLS connections, as opposed to FTP over SSH (SFTP)?
    What error message do you get?

    posted in Pythonista read more
  • dvader9

    I haven't tested this myself, but seeing that you're using the same lines given as an example on the ftplib documentation site, I noticed that you forgot the parentheses for the prot_p() call. You need this to explicitly secure the connection. I'd give that a shot...

    posted in Pythonista read more
  • dvader9

    +1 for OpenCV. I do image processing when I'm not having fun with Pythonista. I have heavily relied on python's wrappers for OpenCV over the last few years. The speed gain on PIL would be significant, in my opinion.

    That being said, I'm guessing this would be one of the harder libraries to build and support. While the python wrappers have been around for a while, I think that they can still be somewhat temperamental, and not all C++ functions are wrapped.

    posted in Pythonista read more
  • dvader9

    Note that the simple crash in the TableView UI from the ui-tutorial, as reported here is fixed in this latest Xcode template.

    posted in Pythonista read more
  • dvader9

    @omz, thanks for putting time and effort into this. I'm hoping to test some of the ui-tutorial scripts in the old and updated project template over the next few days.

    While this is not your main focus in updating Pythonista, I hope the output of those tests - conducted by me or someone else - will help guide the app development.

    posted in Pythonista read more
  • dvader9

    Note that this DOES NOT crash when run in the Pythonista App on the iPad (iOS7 with Pythonista 1.5, or iOS8 with Pythonista 1.6). But it DOES crash when run in the iOS Simulator (iOS8) or on the iPad (iOS8) as a compiled Xcode project.

    posted in Pythonista read more
  • dvader9

    I've tried to run an Xcode project with the simple tableview example provided in the ui-tutorial post (ShowTableView.py and ShowTableView.pyui from https://omz-forums.appspot.com/pythonista/post/5588266841538560). This crashes every time for me at startup, even before I start interact with the table. So I'm wondering about the following:

    • for those who are also using Xcode with Pythonista, do you mind giving it a shot, and let me know if this also crashes for you?

    • @omz, if it's not too much to ask, can you try to run in on your machine, and see if this is a fixable (or already fixed in 1.6) bug?

    • the only thing that you'll need to change in the .py script, is ensure that your project knows where to find the .pyui file. There have been previous discussions on this.

    For those interested, the output of the crash, as displayed in Xcode, is the following:

    2015-01-17 13:56:40.494 PythonistaProject[4675:194482] +[UIResponder om_firstResponder]: unrecognized selector sent to class 0x2c81314

    2015-01-17 13:56:40.942 PythonistaProject[4675:194482] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIResponder om_firstResponder]: unrecognized selector sent to class 0x2c81314'

    *** First throw call stack:

    (

    0   CoreFoundation                      0x044a9946 __exceptionPreprocess + 182
    
    1   libobjc.A.dylib                     0x0412ea97 objc_exception_throw + 44
    
    2   CoreFoundation                      0x044b1465 +[NSObject(NSObject) doesNotRecognizeSelector:] + 277
    
    3   CoreFoundation                      0x043fa3e7 ___forwarding___ + 1047
    
    4   CoreFoundation                      0x043f9fae _CF_forwarding_prep_0 + 14
    
    5   PythonistaProject                   0x00433273 -[SUITableView tableView:didEndDisplayingCell:forRowAtIndexPath:] + 39
    
    6   UIKit                               0x02031c09 -[UITableView _reuseTableViewCell:withIndexPath:didEndDisplaying:] + 169
    
    7   UIKit                               0x0203f3d5 __25-[UITableView reloadData]_block_invoke1575 + 148
    
    8   CoreFoundation                      0x043cfe33 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 99
    
    9   CoreFoundation                      0x043cf4cf -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
    
    10  UIKit                               0x0203ea52 -[UITableView reloadData] + 1487
    
    11  PythonistaProject                   0x0044f21b __TableView_reload_block_invoke + 39
    
    12  PythonistaProject                   0x0041fdd4 __sui_dispatch_main_sync_block_invoke + 51
    
    13  libdispatch.dylib                   0x04aa4e2f _dispatch_client_callout + 14
    
    14  libdispatch.dylib                   0x04a8e0aa _dispatch_barrier_sync_f_slow_invoke + 115
    
    15  libdispatch.dylib                   0x04aa4e2f _dispatch_client_callout + 14
    
    16  libdispatch.dylib                   0x04a8b90e _dispatch_main_queue_callback_4CF + 606
    
    17  CoreFoundation                      0x0440395e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
    
    18  CoreFoundation                      0x043c2760 __CFRunLoopRun + 2256
    
    19  CoreFoundation                      0x043c1bcb CFRunLoopRunSpecific + 443
    
    20  CoreFoundation                      0x043c19fb CFRunLoopRunInMode + 123
    
    21  GraphicsServices                    0x067c924f GSEventRunModal + 192
    
    22  GraphicsServices                    0x067c908c GSEventRun + 104
    
    23  UIKit                               0x01f338b6 UIApplicationMain + 1526
    
    24  PythonistaProject                   0x0001c756 main + 134
    
    25  libdyld.dylib                       0x04ad0ac9 start + 1
    

    )

    libc++abi.dylib: terminating with uncaught exception of type NSException

    (lldb)

    I started looking specifically into this example, because I had another project I was trying to build, which also had a TableView in it, and crashed every time a TableView Cell move in/out of the field of view when scrolling, with this same message: 'unrecognized selector sent to class'.

    While I know this (Pythonista in Xcode) isn't the main focus of this forum, I'm not sure where else to look for a solution on this. Thanks all for your help.

    posted in Pythonista read more
  • dvader9

    You can easily add files to your Xcode project. The only tricky thing is telling the App where to search for those auxiliary files.

    See http://omz-forums.appspot.com/pythonista/post/5234293353742336 for some tips on working with Xcode and the App template.

    If you have other specific questions on this, I'd be happy to try to answer them based on my limited experience.

    Good luck!

    posted in Pythonista read more
  • dvader9

    @omz, I don't know what your timeline on releasing 1.6 is, but I was wondering whether pandas might make it in there. I have also sent a couple of beta testing requests to the support email over the last month, with no response; are you still looking for people to test 1.6 beta?

    posted in Pythonista read more
  • dvader9

    @JonB, thanks for the example. It does work fine on my iPad as well. The syntax is essentially what I have in my code, with a ui.Button activating a photo capture in the background. I haven't had a ton of time to look at the possible differences.

    I'll say this, though. The one thing that made things work in my fullscreen view, was having hide_title_bar=True. This was independent of having the console show/hide activity. If this points to anything in particular, let me know. If/when I have time to dig a bit more into it, I'll add a new post.

    posted in Pythonista read more
  • dvader9

    Apologies for not updating this earlier.

    I spent a bit of time tonight on Xcode 6.1, looking at where files are going. First, a few notes on setting up:

    • Used the latest template linked to in the forum.

    • when I open that template in Xcode 6.1, it pops up with a couple of comments on having to optimize a couple of parameters. I can't remember what those were now, but I just agreed. Didn't seem to matter that much.

    • I use the tree structure setup by @omz, i.e. the main script is directly under the project root.

    • In Finder, I make a 'script' folder in the main project directory. All of my .py and .pyui files go there.

    • In Finder, I make an 'image' folder, where I put all of my supporting images.

    • In Xcode, I make a 'Script' group (looks like a yellow folder), and add all of the files in the 'script' Finder folder to that group. Note that those groups - those seen in a yellow folder - are just a convenient way to group and organize resources.

    • In Xcode, I make a 'my_images' group - also yellow folder - and add all of the files in the 'image' Finder folder to that group. Again, just a convenient way for Xcode to organize files. This is in contrast to the BLUE 'Textures' folder, which directly links to the 'Textures' subfolder in Finder. Any file you see in Finder in that subfolder, will automatically appear in your Xcode project in the 'Textures' BLUE folder.

    • With all this being done, I open the 'AppDelegate.m' file in Xcode and add, before the '@end' line, the few lines of code posted by @omz, which address the fopen, fwrite and putenv objects. You can find those at https://omz-forums.appspot.com/pythonista/post/5862618212335616.

    • somewhere in your main script, or in supporting scripts, you'll need the find_bundled_files function described in another post.

    • If you organize your project as I describe here, all of your .pyui files will end up in the main App folder, just one branch above the os.py file as seen above, in the PythonistaProject.App folder, if you haven't changed anything further in your project. Note that all resources, .py, .pyui, custom images, text files that I've added ended up in here. The ONLY file that was in the Documents folder (os.path.join(os.path.expanduser('~'), Documents) is the main script (Script.py).

    I'm sure there are other ways to organize your folders. I've started reading through some of the 'Build' scripts that the Xcode template has. This is where you see the destination of files in your App. You can try playing around with stuff there. But if you don't, I would recommend start with the find_bundled_files script to find your specific resources, and once you know where to locate them, you can hard-code the relative path, so that your App starts up faster. I'm hoping to do that as an update to the drawing App I developed with my kids ("Drawing with Sonia") and posted recently on the App Store; it does have a bit of a slower launch.

    In addition to all this, a couple more comments - sorry for the very long post:

    • If you click on the Project root in Xcode and look at the General properties, I recommend switching to using Xcode assets (.xcassets) files for the app icon and launch images. They've added that functionality since Xcode 5. You just drag and drop the images in there, and it manages everything else for you.

    • In the main info.plist file, I've always had to switch the 'Application requires iPhone environment' to YES, otherwise, things don't work for me. Even though the only App I've posted is an iPad App, that flag seemed to be necessary.

    • As @omz suggested, if you don't need matplotlib, numpy, images, sounds or other resources already included, I definitely recommend removing them carefully. The base size of an App, if you just use it as is, will run over 50MB just from having to compile for the different processors as well.

    • And speaking of different processors supported: again clicking on the main Project root, and going in to the 'Build Settings', you need to remove 'arm64' from the 'Valid Architectures'. Currently, the project isn't compatible with 64-bit, but @omz recently confirmed in another post that he has that support ready for a future version, even though it does take up more space as a project.

    • Finally, I would recommend trying to figure out a good place in your App, or in the online description, to give proper credit where it's due. Whether it's recognizing all the hard work @omz has put into Pythonista, or any resources he's included in the template, or any resources you're adding yourself.

    I believe these are most of the tips I can give to you. When it comes to setting up a Developer account and figuring out the iOS App development and posting pipeline, it took me a good several weeks to pass that hurdle, but it is certainly doable. I wish you good luck with that part, and look forward to seeing what can be accomplished with the Pythonista framework.

    posted in Pythonista read more
  • dvader9

    Resurrecting this old thread... I was just trying to open a capture_image interface from another simple UI view. The capture interface was called just fine with a button in a sheet view on the iPad, but when I tried to call the capture interface from a button in a fullscreen view, the whole program (script and Pythonista itself) froze. Has anybody else seen this?

    posted in Pythonista read more
  • dvader9

    Apologies for the delay on getting back to this post. I hope you all had a nice holiday.

    A few things before I put together a description of my workflow and experience in moving from Pythonista to Xcode, to an iOS App in the store:

    a) as others have before, I managed to get an App in the store using Pythonista. It is a simple and free drawing app that I made with my kids - similar to one other forum contributor, if I remember right. You can see for yourself at https://itunes.apple.com/us/app/drawing-with-sonia/id925557850?ls=1&mt=8

    b) As I mentioned earlier, the current pythonista library in Xcode, as far as I can tell, doesn't support 64-bit. This is a bigger issue, because as of February 1st, Apple will not accept any new apps that don't support 64-bit. As of the summer, they won't accept any updated apps that don't support 64-bit. So we have a very rapidly closing window here, unless the next version of a template comes with 64-bit support.

    c) @omz, is there a plan to release another Xcode template soon that will have 64-bit support? If not, then much of this discussion is void (see bullet point b). If you are hesitant about this, @omz, please know that we all appreciate all the effort you've already put into Pythonista. And I probably can speak on behalf of others, when I say that those interested in export to Xcode, would be willing to pay extra (Paypal, or In-App purchase) to have an updated template.

    Once we have c), primarily, addressed, I think that we can move on to answer the question. I am a bit weary of spending more time putting this info together, if it is not supported for more than 3 weeks down the road, as I'm sure you can understand.

    posted in Pythonista read more
  • dvader9

    @JonB, both forum threads you've linked to are relevant to making the Xcode template work.

    I'm hoping that I (or someone else) can put together at least a few bullet points for the forum, that will guide other people in the translation of scripts toward a working Xcode project.

    Off the top of my head, what I perceived as "broken" pieces with Xcode 6.1 are:

    a) support for 64-bit architecture, so you need to make sure you change the project settings to compile for non-64-bit for now. Not sure if support for 64-bit is coming down the road in Pythonista 1.6.

    b) path to supporting files is not a trivial issue, so we need to figure out where .py, .pyui, images and other files are located. Ole's Textures directory seems to be visible from everywhere, so using any images and icons from that directory hasn't caused any problems on my end. For other files, using the find_bundled_files script can help you debug the location of your files (see https://omz-forums.appspot.com/pythonista/post/5234293353742336)

    c) other than the path to supporting files, I've seen some slight differences in certain Views (e.g. height of a small pop-over) between iOS 7 and iOS 8. My solution has been to create two different scripts that deal with these two operating systems. Not pretty, but it has worked.

    Note that my experience in making apps is very limited. I'm still waiting to hear back (after 2 weeks) whether an app I did with my daughter will make it through to the store - another simple drawing App. I'll make sure to update the thread that pertains to Pythonista-based Apps, should that be the case.

    Hope this helps. Something more comprehensive will be useful for all.

    posted in Pythonista read more
  • dvader9

    I'm assuming the current version of the compiled pythonista library doesn't have 64-bit support. Please correct me if I'm wrong.

    If you wish to compile your app in Xcode, for now, you may have to disable x86-64 architecture. But keep in mind that Apple will require 64-bit support as of February.

    I am in no position to write an Xcode tutorial, but have been playing with it recently. I can post a few gathered tips in a few days perhaps, after the holidays. Please remind me if I've forgotten; but don't let this prevent anybody else with experience to share their story.

    posted in Pythonista read more
  • dvader9

    It does seem like expanduser and initial Script directory are in the Application Data files consistently in iOS 8, while the supporting libraries are in the Application Bundle files. I'll have to see what the implications are for the find_bundle_files function, and where to start walking through the directories.

    Any other observations?

    I'm now upgraded to iOS 8 and Xcode 6.1, but it would be useful to have this written down for iOS 7 as well.

    posted in Pythonista read more
  • dvader9

    in Pythonista on iPad running iOS 8.1

    beginning of test printout

    BASE = /private/var/mobile/Containers

    user $BASE/Data/Application/number_and_letters_1

    cwd $BASE/Data/Application/numbers_letters_1/Documents/

    current $BASE/Data/Application/numbers_letters_1/Documents/Script.py

    os file $BASE/Bundle/Application/numbers_letters_2/Pythonista.app/pylib/os.py

    image file $BASE/Bundle/Application/numbers_letters_2/Pythonista.app/Textures/Test_Lenna.png

    end of test printout

    in IOS simulator

    beginning of test printout

    BASE = /Users/dvader/Library/Developer/CoreSimulator/Devices/numbers_letters_3/data/Containers

    user $BASE/Data/Application/numbers_letters_4

    cwd $BASE/Data/Applications/numbers_letters_4/Documents

    current file $BASE/Data/Applications/numbers_letters_4>/Documents/Script.py

    os file $BASE/Bundle/Application/numbers_letters_5/PythonistaProject.app/pylib/os.py

    image file $BASE/Bundle/Application/numbers_letters_5/PythonistaProject.App/Textures/Test_Lenna.png

    end of test printout

    ad hoc build on iPad running iOS 8.1

    beginning of test printout

    BASE = /private/var/mobile/Containers

    user $BASE/Data/Application/numbers_letters_6

    cwd $BASE/Data/Application/numbers_letters_6/Documents

    current $BASE/Data/Application/numbers_letters_6/Documents/Script.py

    os file $BASE/Bundle/Application/numbers_letters_7/Pythonista.app/pylib/os.py

    image file $BASE/Bundle/Application/numbers_letters_7/Pythonista.app/Textures/Test_Lenna.png

    end of test printout

    posted in Pythonista read more
  • dvader9

    I started to run similar print commands last night already, to try and figure this out. I'll run the exact script you mentioned and post the output tonight.

    From my quick reading of the Apple documentation on file structure handling in iOS 8, they encourage/force you to query the OS when you start your App, to receive what the path to your docs is, because it doesn't seem to be the same every time. I think that's part of the changes they needed to add "app bundles". I have only started reading on this recently, so perhaps my interpretation of the documentation is wrong, so don't quote me on this.

    Anyhow, will post those results. Thanks for the suggestion, @JonB.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!