![]() ![]() The playsound module is a cross platform module that can play audio files. Related course: Complete Python Programming Course & Exercises Play sound in Python playsound module The audio file should be in the same directory as your python program, unless you specify a path. The main difference is in the ease of use and supported file formats. These solutions are cross platform (Windows, Mac, Linux). There are several modules that can play a sound file (.wav). I'm quite good at that.Play sound on Python is easy. I'll go away.īut if you have Forth questions, I'm happy to answer them. I probably spent 4 or 5 hours attempting to solve this before I bothered to ask a question on this board. I put the python source file I'm trying to import ( and the simple example above) all over my Raspbian system (desktop, folder with the source I'm calling from) and on the root directory of the Pico.Īs I mentioned, all I get is: ImportError: no module named xxxx That's probably one of the reasons I thought the interpreter was some kind of token threading. I also can't find those libraries on my system. I can import when the library is created with the PyPl package manager. I came with, I thought, a reasonable question: why can't I import? I tried backing off and creating a simple file - a.py that contained almost nothing.Īnd then I created b.py that only contained: include a No matter what I've tried.Įverything has to be one file, or things included with the system. I took a source library from circuitpython repository and placed it into a source file in my micropython and it works. I'm not sure why you've commented about my doing that. I've created a simple carrier board holding the Pico and 4 motor drivers, OLED display, etc etc because I got tired of designing full custom solutions.Īnd I'm not trying to mix circuitpython and micropython. ![]() In my retirement I thought it would be nice to create some open source astronomy projects, and the short path was to use libraries available in python. Python is only appealing to me (and it's a big appeal) because of the breadth of the libraries available. I've been writing in a threaded language (Forth) professionally for 45 years now. Obviously I've missed some Python fundamentals. Those are still only pulled in at run time. *: Some python interpreters compile to byte code but unlike statically linked C (and other languages) programs this does not pull in the libraries/modules. Without that all we can do is guess which is likely to waste everyone's time. You should focus on finding (and telling us) why the import fails and with what error(s). It's my experience that importing a custom module/file just works (see ) though I've no idea whether mixing micropython and circuitpython is a good idea or not. If you're running the code in thonny, it must be in the cwd or any of the standard locations for python libraries. If you're running your code in the Pico's REPL the file should be in the root folder of the micropython file system (this is not the file system exposed by the bootsel button). With pico and thonny it can depend on how thonny is configured. If you import foo the interpreter will look for a file called foo.py starting in the cwd. The interpreter must be able to find the required file(s) or the import will fail. Source and object code is the same thing.* Python is an interpreted language not a compiled one. You appear to misunderstanf some python fundamentals. Surely the source code for a project doesn't have to be on the target! ![]()
0 Comments
Leave a Reply. |