I am trying to convert midi files to .wav files using midi2audio. The code is taken from the documentation and doesn't throw any error. However, there doesn't seem to be any new wav file. Here are the code lines:
fs = FluidSynth()
fs.midi_to_audio('input.mid', 'output.wav')
I haven't found any useful information about my problem, neither in the documentation (I have fluidsynth installed, so that shouldn't be the problem) nor in other questions.
notes: I'm using python 3.6
Any help will be appreciated
do you have some fonts loaded ? run the program in debug mode to see the path required and put font files.
Related
I want to speed up my python code so i tried to translate it in c thanks to cython. I followed the basics tutorials and other youtube videos and i finally could create a functions_cython.c file. But somehow i just can't import it. I tried to import it in my main file, i also tried in another file named 'testing.py' but I always receive errors saying that the module 'functions_cython' does not exist, while it actually is in the file. Do you have any idea why ? (i linked some images if that can help)
The problem was because I was using PyCharm's "community version" and this version (in opposition of the professional one) does not allow to import .c formats. I switched to VS Code.
I am working in ios and with spyder (anaconda) trying the following code in order to convert docx files which are in a directory (folder_path):
from docx2pdf import convert
import os
no_pdfs = []
i=1
for filename in os.listdir(os.path.normcase(folder_path)):
filename = os.path.join(folder_path, filename)
try:
convert(filename, os.path.splitext(filename)[0]+'.pdf')
print(f"DONE - {i}: {os.path.basename(filename)}")
i += 1
except Exception:
no_pdfs.append(os.path.basename(filename))
print(no_pdfs)
I use try - except in my code because there is the .DS_Store that appears with ios and nothing happens.
If I brutally try convert() I get the error: ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html but I am not really able to understand what goes wrong.
An extra thing is that my initial files are not actually .docx but .doc and I would really like a piece of advice where I could convert doc to pdf or doc to docx to pdf.
Any help will be much appreciated!
If you haven't resolved this yet, you could try installing the Parallels Access from the Apple store on your ios but it sounds like you just have to update your packages (pip install --upgrade PackageName). The code you provided might be working, but the error is being flagged from those packages you mentioned. Also with docx2pdf, have you installed word on your device? From the creator of docx2pdf "Unfortunately, it requires Microsoft Office to be installed and thus only works on Windows and macOS. – Al Johri"
Also, An efficient way to convert document to pdf format is worth reading.
I'm trying to run this piece of code but I'm getting the same error repeatedly. At first I tried it in Pycharm IDE but got an error "file not found", I thought maybe there's some package installation issue. So, I started working in Google Colab but here, too, I'm getting the same error, can someone point out what's the issue? I'm sharing the code snippet:
from PIL import Image
strokeimgs = ['dance stroke 1.png']
strokeimg = Image.open(strokeimgs)
I get this error message as a result, is this issue related to PIL library or is it related to the file location?
I was making one mistake which I was not even aware of. The thing is that I uploaded images files to a folder named "project_folder" which is residing inside a folder i.e. "Assignment_2_folder", which is my working directory. So, you've to upload your files directly to the working directory, otherwise, it will not be able to read it. I have attached the image which will make it further clear. Thus, I uploaded my images files to my working directory i.e. Assignment_2_folder, it was then able to read it.
I have a problem with exporting my python project. In this project, I am using the NLTK library, but when exporting it using the Pyinstaller tool the error mentioned in the title appears. I've been scouring a solution for weeks and I have not gotten an answer. I tried to use cx_freeze but other errors appear ... could anyone help me?
Tried use cx_freeze, and Pyapp.
'''Unable to find "/usr/nltk_data" when adding binary and data files.
I solved the problems editing the pyinstaller nltk-hook. After much research, I decided to go it alone in the code structure. I solved my problem by commenting on the lines:
datas=[]
'''for p in nltk.data.path:
datas.append((p, "nltk_data"))'''
hiddenimports = ["nltk.chunk.named_entity"]
What's more, you need to rename the file: pyi_rth__nltk.cpython-36.pyc to pyi_rth_nltk.cpython-36.pyc . This file have 1 more underline. Warning with the python version.
try making folder in your project /usr/nltk_data and there paste your nltk data.
do you have space in your username? avoid it.
nltk.download()
check the path there, or change it.
Wand needs the ImageMagick library to perform. When I do as they explain here my code works just fine on my computer.
However, when I freeze it with cx_freeze it misses the extra library. I don't know how to add that library to the zip. I know how to add .dll files into the folder, but I can't figure out which .dlls Wand needs. When I tried putting all the .dlls in the folder it ran but it couldn't convert images.
Update:
So I included CORE_RL_wand_*.dll and CORE_RL_magick_*.dll in the folder. Running it I gives me an error:
can't start because CORE_RL_bzlib_.dll is missing
I added that one and 20 others as it needed them. After that the app starts, but when I try to open and resize and covert an image, I get:
wand\resource.py line 223, wand.exception.MissingDelegateError: NoDecodeDelegateForThisImageFormat 'pathblah.jpg' # error/constitute.c/ReadImage/552
I don't know how to get rid of this.
You need to include CORE_RL_wand_*.dll and CORE_RL_magick_*.dll to the zip.