Webconf: error 500 [SOLVED]


#1

Hello,

I haven’t used the webconf much so maybe I missed something…

When I click on ‘save’ after I define a new map rule I get a 500 internal error.
Here is the traceback:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/tornado/web.py”, line 1346, in _execute
result = method(*self.path_args, **self.path_kwargs)
File “/usr/local/lib/python3.4/dist-packages/tornado/web.py”, line 2626, in wrapper
return method(self, *args, **kwargs)
File “/zynthian/zynthian-webconf/lib/midi_config_handler.py”, line 339, in post
zynconf.update_midi_profile(escaped_request_arguments, self.current_midi_profile_script)
File “/zynthian/zynthian-ui/zynconf/zynthian_config.py”, line 217, in update_midi_profile
save_config(midi_params, False, fpath)
File “/zynthian/zynthian-ui/zynconf/zynthian_config.py”, line 141, in save_config
logging.info(lines[add_row])
IndexError: list index out of range
ERROR:tornado.access:500 POST /api/ui-midi (10.42.0.1) 76.96ms

I also get a 500 error for other action (ex: create a new midi profile). Here is the traceback

File “/usr/local/lib/python3.4/dist-packages/tornado/web.py”, line 1346, in _execute
result = method(*self.path_args, **self.path_kwargs)
File “/usr/local/lib/python3.4/dist-packages/tornado/web.py”, line 2626, in wrapper
return method(self, *args, **kwargs)
File “/zynthian/zynthian-webconf/lib/midi_config_handler.py”, line 314, in post
zynconf.update_midi_profile(escaped_request_arguments, new_profile_script_path)
File “/zynthian/zynthian-ui/zynconf/zynthian_config.py”, line 217, in update_midi_profile
save_config(midi_params, False, fpath)
File “/zynthian/zynthian-ui/zynconf/zynthian_config.py”, line 109, in save_config
with open(fpath) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/zynthian/zynthian-my-data/midi-profiles/map_notes.sh’

Any idea, please ?

Cheers,
Claude


Single Channel Mode not working [SOLVED]
#2

The first error…

The source code on github

Is a failure to write information to the logging system.
Python allows the setting up of a log mechanism and this line writes an info log event with the value contained in the add_rows 'th element in the python list lines

Now there are a couple of limitations on what add_rows can be …

A python list is simply that a list of things and you access individual things in the list by giving it an number and cos it’s python this number counts from 0 ( this is a good thing but feels a bit weird initially). it has to be a number, but in this case there isn’t a list element that corresponds.

Quite why this is the case is of more interest…
What is curious is the line above the line it failed on…

lines.insert(add_row,"export %s=\"%s\"\n" % (varname,value))

Actually adds a value into the line that it is about tp pick up.

But the list insert command has an interesting characteristic

>>> l = [0,1,2,3,4]                               #  make a list with 5 elements the old fashioned way ....
>>> l.insert(43,43)                              # Insert the number 43 into the 43'rd element   
>>> l                                                   # display the list l
[0, 1, 2, 3, 4, 43]                                 # 43 has been added to the end . . ..                            
>>> l[43]                                             # but not at element number 43
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> 

I think this might be the bug…

from the python docs:

list.insert(i, x)
Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).

So it’s not insert AT it’s insert BEFORE.

Even Guido got in on this one. . . . :smiley:

From: Guido van Rossum <gui...@python.org>

Mon, 15 Sep 2014 15:54:57 -0700

This functionality has existed since the earliest days of Python, and even if we all agreed it was wrong we couldn’t change it – it would just break too much existing code. I can’t quite remember why I did it that way but it was definitely a conscious choice; probably some symmetry or edge case. (Note that it works this way at the other end too – a.insert(-100, x) will insert x at the beginning of a, if a has fewer than 100 elements.)


#3

Please update and try again.


#4

Hi all,

thank you very much for the quick reply !

After the update, I am now able to create a new profile.
Saving a midi config to this new profile works fine.

But I am still unable to save on the ‘default’ profile:
“IndexError: list index out of range” error again.

I don’t know if there is a link, but when I save to the default profile, there are less debug info.
For example, the env ‘ZYNTHIAN_MIDI_PROG_CHANGE_ZS3’ is missing from the logs. As well as ‘ZYNTHIAN_SCRIPT_MIDI_PROFILE’. Those debug info are seen when saving to the new profile though.

Thank very much again,
Claude


#5

please try again. zynthian-ui and zynthian-webconf changed


#6

Thank you Markus,

I have updated and rebooted.
This is my test case:

  • select default on midi web UI
  • untick ZS3
  • Save

Result: Error 500

File "/zynthian/zynthian-ui/zynconf/zynthian_config.py", line 140, in save_config
    logging.info(lines[add_row])
IndexError: list index out of range

#7

that works for me.
What are your “numbers”?
zyncoder: [master (e5859ec)]

zynthian-ui: [master (b7eba0d)]

zynthian-sys: [master (54a4967)]

zynthian-data: [master (6712b1c)]

zynthian-webconf: [master (763c7a6)]


#8

I have the same versions:
zyncoder: [master (e5859ec)]
zynthian-ui: [master (b7eba0d)]
zynthian-sys: [master (54a4967)]
zynthian-data: [master (6712b1c)]
zynthian-webconf: [master (763c7a6)]


#9

Maybe you could try deleting the profiles, so that new ones are generated?


#10

@claudev
or an update of the system


#11

Thanks! This worked. After deleteing and updating again i can now save all the settings from webconf.


#12

Hello,

After I updated the system, the problem is now solved. I can save on the default profile. I did not delete the default profile.

Thank you,
Claude