Kara-Moon Forum
April 20, 2024, 01:53:58 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-gb crash  (Read 4326 times)
sciurius
Sr. Member
****
Posts: 443



« on: September 10, 2020, 01:39:04 PM »

I don't use mma-gb often, but I pretty sure it worked before...

mma-gb displays its window with all available styles.
When I select a style to play (e.g. stdlib/ballad) I get an error dialog

Code:
Can't access /usr/share/mma/lib/stdlib/ballad.mma. This is configuration error

File /usr/share/mma/lib/stdlib/ballad.mma is present and available.

When I click on Re-read Grooves, mma-gb crashes:

Code:
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/bin/mma-gb", line 526, in updatedb
    db = update_groove_db(libPath, '', self.lbdesc )
  File "/bin/mma-gb", line 129, in update_groove_db
    gdict.update(update_groove_db(root, os.path.join(dir, f), textbox))
  File "/bin/mma-gb", line 165, in update_groove_db
    gg[output[i].strip()] = output[i+1].strip()
IndexError: list index out of range
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #1 on: September 10, 2020, 04:36:49 PM »

I hate to be no help at all and say "it works here just fine" ... but, it works here.

I am running python3 as my default (just like you) and other than that I think our systems are pretty much the same.

If mma-gb can't find mma there would be errors long before you got to the reported error.

A couple of things you can check:

    1. Change the first line from "python" to "python3", but I doubt that is the cause
    2. The error generated is really one of those "should never happen" things.The line at 598 is not exiting the mma-gb ... just printing the message that the file can't be found. So, can you check permissions, etc for that file.
    3. Is the mma database up-to-date? Try running a mma -g first.

Honestly, I'm not seeing anything here.

     
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #2 on: September 10, 2020, 05:06:55 PM »

I'll add that when I see errors like this the first question I ask myself is "are there permission errors" happening. So, check read/write perms on what is being read and created please. And if you find a problem there the program should report it!
Logged

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



« Reply #3 on: September 10, 2020, 05:49:08 PM »

It usually helps to reveal the exception:

Code:
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "mma-gb", line 474, in showFileDoubleClick
    self.displayFile( libPath + os.sep + self.lb.get(self.lb.nearest(w.y)) )
  File "mma-gb", line 596, in displayFile
    infile=file(fileName)
NameError: name 'file' is not defined

Apparently my python (3.7.9)  does not know the 'file' method. When I change it to 'open' mma-gb works again.
Logged
sciurius
Sr. Member
****
Posts: 443



« Reply #4 on: September 10, 2020, 05:53:50 PM »

https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins:

* Removed file. Use open().

Surprising it still works for you with Python3....
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 on: September 10, 2020, 06:46:36 PM »

Okay, that's completely goofy! I just checked and I am using py3 in mma-gb ... confirmed with a print() statement. And, my python is 3.8.2 which is later than yours. I wonder if file() was re-added? I'll change the program just to be safe!
Logged

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



« Reply #6 on: September 10, 2020, 07:26:27 PM »

Code:
% python
Python 3.7.9 (default, Aug 19 2020, 17:05:11)
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = file("foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'file' is not defined
>>>

What does yours show?
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #7 on: September 11, 2020, 04:10:56 PM »

Like I said ... it's goofy!

bob$ python
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> file = ("foo")

Also, the correct line to use is: infile=open(fileName, 'r') with the 'r'.

Logged

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



« Reply #8 on: September 11, 2020, 07:28:01 PM »

I would like to see your pythons response when you type
Code:
x = file("foo")
like I did...
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #9 on: September 11, 2020, 11:23:53 PM »

Yeah, well ... I was in a hurry when I did that little test Smiley

And, yes, I get the same error as you do. So, now ... why was mma-gb working for me? Oh well, it works now!
Logged

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



« Reply #10 on: September 12, 2020, 07:50:46 AM »

And it confirms two things:

One, they didn't add file() in 3.8.x again.

Second, even though you were pretty sure that you were using python3 (for mma-gb) it was, in fact, running python2. Which may be relevant to keep in mind if other issues show up.
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #11 on: September 12, 2020, 04:24:11 PM »


One, they didn't add file() in 3.8.x again.

[\quote]

Yes. That was odd.

Quote
Second, even though you were pretty sure that you were using python3 (for mma-gb) it was, in fact, running python2. Which may be relevant to keep in mind if other issues show up.

No. I'm sure I was running py3 for the tests. I put it a "this is py3" line in the "if PY3" block at the top of the code when I tested.

The problem was that I never ran the crashing code here Smiley It only gets called when you double-click in the top panel to display a groove file and I never did that. All I did was generate a midi file. Sorry.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #12 on: September 12, 2020, 04:51:36 PM »

Oh, and this really shows why people much smarted than me in the python community say "don't use non-specific exceptions". IN this bit of code the except catches any error (including syntax and missing commands) and reports it as a "config error" in the new window. Not too useful. I must repeat to myself "don't misuse expect like this" and repeat it at least 20 times!!!!!
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.061 seconds with 19 queries.