How can I convert stl files to ply files efficiently in Python? - python

Is there a way of converting stl (STereoLithography) files to ply (Polygon File Format) format in Python? I have to use another program that only accepts ply format.
Here is the link to the program that I want to use: http://www.cs.jhu.edu/~misha/Code/ShapeSPH/ShapeDescriptor/
Any other suggestions regarding how I could use this program?
My second question, can I use this .exe file by using Python? Should it be something like :
os.popen("file.exe --in value", shell=True)
os.system("file.exe --in value")
Am I right?

Related

Convert Latex file to PDF

I am trying to convert a latex document to a pdf document are there any commands in python by which I can do this.
From here
Try this please.
import os
os.system("pdflatex mylatex.tex")
in addition, you can use os.system("mv mylatex.pdf path/to/directory") to move the pdf to any specific location
Alternatively, and more "clean" solution is without os.system() that runs the shell here. You can use subprocess.check_call(['pdflatex', 'mylatex.tex']) instead. To save the result in a specific location: pass the appropriate command-line argument to pdflatex or use shutil.move().

Preview Score from MIDI file in python

I would like to be able to get png of a score from a MIDI file from within a python program.
Separately, I know MuseScore is able to open MIDI files and convert them into a score, so this should theoretically be possible.
My current solution is to just use the lilypond functions !midi2ly and !lilypond -fpng, but midi2ly struggles a bit with the midis I use due to the number of voices present.
!midi2ly "sample from g.midi"
!lilypond -fpng "sample from g-midi.ly"
Here is the ideal output (from MuseScore) and lilypond's attempt output
https://imgur.com/a/9fqJLSA
Try music21!
import music21
parsed = music21.converter.parse('source.mid')
parsed.show('musicxml.png')
Use .write() rather than .show() if you don't want to launch a viewer.

Proper format for a file name in python

I'm importing an mp3 file using IPython (more specifically, the IPython.display.display(IPython.display.Audio() command) and I wanted to know if there was a specific way you were supposed to format the file path.
The documentation says it takes the file path so I assumed (perhaps incorrectly) that it should be something like \home\downloads\randomfile.mp3 which I used an online converter to convert into unicode. I put that in (using, of course, filename=u'unicode here' but that didn't work, instead giving a bunch of errors. I tried reformatting it in different ways (just \downloads\randomfile.mp3, etc) but none of them worked. For those who are curious, here is the unicode characters: \u005c\u0044\u006f\u0077\u006e\u006c\u006f\u0061\u0064\u0073\u005c\u0062\u0064\u0061\u0079\u0069\u006e\u0073\u0074\u0072\u0075\u006d\u0065\u006e\u0074\u002e\u006d\u0070\u0033 which translates to \home\Downloads\bdayinstrument.mp3, I believe.
So, am I doing something wrong? What is the correct way to format the "file path"?
Thanks!

How to parse .kar files in Python?

I need to parse a .KAR file to read your lyrics and print in the screen, how I parse a .kar file using Python?
Karapython may do what you need.
If you're looking to roll your own solution, you may need to learn how to use Python's struct library.

Python script to convert po file to localized json

I need python script to convert po file to localized json.
you might start here http://docs.python.org/library/gettext.html and here http://docs.python.org/library/json.html
http://jsgettext.berlios.de/ contains a .po to json converter (p.erl) - for python you can use polib to access .po file contents and transform as desired

Categories