kpiechura / speechy-recon-app

Project targets into text-to-speech/voice recognition implementation for database of writers and their novels.
MIT License
0 stars 0 forks source link

Backend - problem with passing value from input #9

Open kpiechura opened 3 years ago

kpiechura commented 3 years ago

Seems there is problem with passing author's name to database input.

This seems to be an issue --> E3 is an input for Tkinter GUI and on this prints this inputs is fine. But on delete seems like object of JsonObj does not see that var inside:

def del_record(): read_rec = E3.get() print("User want to delete" + read_rec) print("JSON operation...") delete = JsonObj.del_authors(str(read_rec)) print("UUSU" + str(delete))

` def del_authors(self, author_name=" "): with open("writer.json", encoding='utf-8') as jsondata: data = json.load(jsondata)

        found = False
        for i in data:
            if i == author_name: # here author name is NOT PASSED!!!!!
                found = True
                data.pop(i)
                showinfo(
                    title='Remove record',
                    message='Record' + author_name + 'has been removed!'
                )
                break

        if found == False:
            showinfo(
                title='Remove record',
                message='Record cannot be found!'
            )

        # overwrite json
        open("writer.json", "w").write(
             json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
        )

    return author_name`

Please have a look @hezyrof1997 --> https://github.com/kpiechura/speechy-recon-app/tree/kp/dev_sr_debug

kpiechura commented 3 years ago

Resolved - an instance of new object has need to be created separately to call inside method. Stupid mistakes man...

hezyrof1997 commented 3 years ago

Great work @kpiechura!

kpiechura commented 3 years ago

Already resolved in 0.5 release