Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Music21 Package
-
Wondering if it is possible to get http://web.mit.edu/music21/ working in pythonista. Been wanting to process music data in python and have pythonista be part of my music production workflow.
-
It looks like it's pure Python. Why not try installing it and see if it works for you?
-
There are a bunch of issues when trying to import it
-
What exactly? If you get an error message or traceback, please copy and paste it here, otherwise it's a little hard to tell what the problem is.
;)
-
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/init.py", line 139, in <module>
from music21 import base
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/base.py", line 80, in <module>
from music21.sites import SitesException
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/sites.py", line 19, in <module>
from music21 import common
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/common/init.py", line 45, in <module>
from music21.common.misc import * # most are deprecated!
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/common/misc.py", line 31, in <module>
import multiprocessing
ImportError: No module named multiprocessing -
Multiprocessing is supposed to be in the standard library iirc
-
@scj643
multiprocessing
isn't supported in Pythonista because iOS apps can't spawn child processes (App Store / sandboxing rules). I'm not sure how muchmusic21
actually depends on it. You may be able to fake it by putting an emptymultiprocessing.py
file in the site-packages folder... -
I only looked at the
music21
source code very briefly, but apparently it supports multiple "backends" for the work it does, and one of them uses multiprocessing. As @omz said, it might be enough to put a fakemultiprocessing.py
intosite-packages
(or download the real one from the Python Mercurial repo). You might need to check how you can switch the backend, the multiprocessing one might be the default.@omz Since you've already included
subprocess
even though it can't be used, wouldn't it make sense to also include the other standard modules that depend on forking? Then importing them will work at least. -
adding a fake multiprocessing then reveals a new issue
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/init.py", line 139, in <module>
from music21 import base
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/base.py", line 76, in <module>
from music21 import exceptions21
ImportError: cannot import name exceptions21猀 -
@scj643 I haven't tried this, but what's with the '猀' character at the end there? Was that actually in the traceback?
-
@omz Doubt it, because that's not in the line before.
-
New trace back error log
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/init.py", line 167, in <module>
from music21 import * # @UnresolvedImport # pylint: disable=wildcard-import
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/abcFormat/init.py", line 47, in <module>
from music21.abcFormat import translate
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/abcFormat/translate.py", line 32, in <module>
from music21 import stream
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/stream/init.py", line 44, in <module>
from music21 import metadata
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/metadata/init.py", line 51, in <module>
from music21.metadata import caching
File "/private/var/mobile/Containers/Shared/AppGroup/5FD2FDE6-F810-4A9A-B188-772796B31F62/Documents/site-packages/music21/metadata/caching.py", line 414, in <module>
class WorkerProcess(multiprocessing.Process): # @UndefinedVariable pylint: disable=inherit-non-class
AttributeError: 'module' object has no attribute 'Process'