Permission error with multiprocessing.Process
max last edited by max
I was testing the multiprocessing module and I ran this script on PC and it works fine, but using Pythonista on IOS gives PermissionError: [Errno 1] Operation not permitted. Anyone know how to fix this?
from multiprocessing import Process def f(name): print('hello', name) if __name__ == '__main__': p = Process(target=f, args=('bob')) p.start() p.join()
JonB last edited by
multiprocessing is not supported on ios.
It's b/o Apple, not b/o Pythonista. Only one process is allowed until Apple relaxes (if ever) this rule.
@zrzka thanks. Do you know of any alternatives that would be supported? I’ve tried threading but it doesn’t do exactly what I need
And what exactly is what I need? No crystal ball here ;)
@zrzka sorry for being vague. I need to run a function multiple times in parallel pretty much
zrzka last edited by zrzka
What kind of function, I mean, what it does? I/O like networking, computational, ...?
Update: Can you elaborate more on what do you want to achieve?
@zrzka yeah. Basically it’s a program that fills and submits out a number of online forms using requests. And i’d Like to run it multiple times in parallel so it can fill multiple forms at a time.
JonB last edited by JonB
Okay, so, Spambot :).
Though you cannot use multiprocessing, you can use asyncio /aiohttp and the like.
There are a few wrappers for requests
Which allow use of asyncio and requests. I have not tried it on pythonista, but many examples of code that use aiohttp show huge increases in number of requests per second. Happy spamming...
@JonB thank you! I’m pretty new to python and coding in general so I appreciate your help
I personally do use
aiomysql, ... and I really enjoy it. It's a huge difference in performance. Was doing some benchmarks for my Slack Applications / bots and the difference was noticeable, even by the end users. (Mostly prototypes / MVPs, reason for experimenting with
Anyway, here's an example. You can learn how to fire & wait for one request and how to fire & wait for many of them.
NOTE: No error handling & coindesk has rate limiting. Run this two, three times and then you have to wait.