So I am using an IDE to do some python excercises. I downloaded some files from the course and need to open them. One .py file calls a .txt file but when I try the path seems to break up. Here’s the error:
PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/Do wnloads/6001x/ProblemSet4/words.txt
I was suspecting the issue was with the space between “Mobile” and “documents” but I tried adding a _ and it still get error
FileNotFoundError: [Errno 2] No such file or directory:
I’m a bit lost on what I should do
The path to downloads has a space in it in the error. ‘do wnloads’
iPad apps are sandboxed, so if you’re executing the python file through your IDE, the most likely reason this is happening is that the process is not allowed to read the downloads folder.
On a side note, what IDE supports python on the iPad?
How use python on ipad? - Stack Overflow
ios - Python on iPhone 6 - Stack Overflow
How can I access my iPhone files (via USB) in Python? - Stack Overflow
iOS : How install and execute Python script? - Stack Overflow
Videos
you may be interesting in https://www.pythonanywhere.com project.
I am using it on ipad too.
If you are using Python for IOS, the following should work, although I haven't yet tried it myself.
Email the program to your own e-mail account as text. Then read the e-mail message on your iPad in any one of several e-mail applications. Cut and paste the text from the e-mail message into the python editor.
Don't cut and paste the code into the interpreter. Then you can't save it, at least not in the current version of Python for IOS. Instead, click on the second icon on the bottom (I think that's the icon, my iPad is at home and I'm not home now), to open the editor. You can save files from the editor using the menu button on the upper right; there's a "save" menu item that allows saving the code to a file on the iPad.
I'll be trying this tonight. Sorry for posting this before trying it, but I'm not sure I'll return to this question later. It 'should' work. (Famous last words!)
I was wondering if there is a way to run a python script inside my IOS app, I'm pretty new to swift so forgive me if I'm asking silly questions
You can use replit (an online ide) to write code online, or use the replit app, but I'm not sure if there is an app for ios
Mobile development
Python doesn’t have built-in mobile development capabilities, but there are packages you can use to create mobile applications, like Kivy, PyQt, or even Beeware’s Toga library.
Kivy- Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. Kivy does not attempt to use native controls or widgets. All of its widgets are custom-drawn. This means that Kivy applications will look the same across all platforms. However, it also means that your app’s look and feel will differ from your user’s native applications. This could be a benefit or a drawback, depending on your audience.PyQt- is a set of Python bindings for The Qt Company's Qt application framework and runs on all platforms supported by Qt including Windows, macOS, Linux, iOS and Android. PyQt6 supports Qt v6, PyQt5 supports Qt v5 and PyQt4 supports Qt v4. The bindings are implemented as a set of Python modules and contain over 1,000 classes.Toga- is a Python native, OS native, cross platform GUI toolkit. Toga consists of a library of base components with a shared interface to simplify platform-agnostic GUI development.
References
- Build a Mobile Application With the Kivy Python Framework
- What is PyQt?
- Toga