Kara-Moon Forum
April 19, 2024, 11:01:59 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: MMA 2002c online  (Read 2492 times)
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« on: May 05, 2020, 09:01:51 PM »

A new release to beat on:

  https://www.mellowood.ca/mma/downloads.html#developer

Lots of nice little fixes and features. See the web page for details.
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #1 on: May 06, 2020, 09:09:41 AM »

Good job. A small problem, though...

You use tempfile.mkstemp, which creates a temp file. Then you use the name for output file. This will be opened later, and since the temp file already exists MMA generates a message:

Overwriting existing midi file (12 bars, 0.40 min / 0:23 m:s): '/tmp/MMA_1t45x9r1.mid'

If you do not want to use tempfile.mktemp (for good reasons) it may be worth to consider something similar to:

    f = tempfile.NamedTemporaryFile(prefix="MMA_", suffix=".mid")
    outfile = f.name
    f.close            # file will be deleted


Should some complain that the output file is opened twice, you can blame python Wink .
Logged
sciurius
Sr. Member
****
Posts: 443



« Reply #2 on: May 06, 2020, 09:11:46 AM »

RPMs for Fedora and others in the usual place:

https://www.squirrel.nl/pub/MMA/
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 on: May 06, 2020, 04:01:20 PM »

Good job. A small problem, though...

You use tempfile.mkstemp, which creates a temp file. Then you use the name for output file. This will be opened later, and since the temp file already exists MMA generates a message:

Overwriting existing midi file (12 bars, 0.40 min / 0:23 m:s): '/tmp/MMA_1t45x9r1.mid'

If you do not want to use tempfile.mktemp (for good reasons) it may be worth to consider something similar to:

    f = tempfile.NamedTemporaryFile(prefix="MMA_", suffix=".mid")
    outfile = f.name
    f.close            # file will be deleted


Should some complain that the output file is opened twice, you can blame python Wink .

Yes, I think the problem with all this: mkstemp() only opens for read, not "rwb". But let look when I get back in a few days ... gotta wedding to go to Smiley
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.048 seconds with 19 queries.