nvpy icon indicating copy to clipboard operation
nvpy copied to clipboard

cannot get nvpy to work in windows

Open RosanneZe opened this issue 3 years ago • 7 comments

I succesfully installed nvpy on windows like this:

  • in powershell, type python, this prompts you to install python 3.8 in the windows store
  • install nvpy with pip install nvpy
  • run nvpy with python -m nvpy

I can start nvpy, but if I try to add a new note, it crashes, and after I closed it, it now crashes immediately on opening. It says "An error occured during housekeeping. list index out of range"

It gives this exception:

\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\nvpy\view.py", line 532, in append
    self.text.insert(tk.END, u'{0:<{w}}'.format(title[:cellwidth - 1], w=cellwidth), ("title,"))
TypeError: slice indices must be integers or None or have an __index__ method

and during the handling of that another exception occured (I cannot copy paste it, because it shows in a window and not in the terminal) in line 667 of view.py "IndexError: list index out of range"

I'm not sure what's going on here. I use nvpy without simplenote, but I've been able to do that without problems on Ubuntu for years.

ETA: I also got errors when I tried the zipped version, I think it was the same error, but I didn't write it down, so I'm not sure.

RosanneZe avatar Nov 05 '20 12:11 RosanneZe

I'm trying to reproduce this issue, but I haven't got a clue yet. To investigate this issue, may I ask the following questions?

  1. What's the version and OS build number of your windows OS?
  2. What's the locale of your PC? It can display by the following command:
    systeminfo | findstr “Locale”
  3. Please execute validate.py and tell me the result. It validates the local database and reports corrupted notes. Note that it may display your private data. When pasting the result, you should mask private data.
  4. Please tell me info if you have any additional info you want to add.

yuuki0xff avatar Nov 05 '20 14:11 yuuki0xff

Thanks for looking into it!

  1. Version 10.0.19042 Build 19042
  2. en-us;English (United States) (both System and Input)
  3. I started from a clean slate to check if the problem was in my linux notes, so no personal info here:
C:\Users\rosan/.nvpy\70087714138c54e6fe1caa3460ec61.json  Invalid
{'content': 'test notitie', 'modifydate': 1604578114.5335133, 'createdate': 1604578114.5335133, 'savedate': 0, 'syncdate': 0, 'tags': []}
Traceback (most recent call last):
  File ".\validate.py", line 18, in <module>
    assert 'key' in obj and type(obj['key']) == str
AssertionError


C:\Users\rosan/.nvpy\deaee939ed087942a3a1d29275cb33.json  Invalid
{'content': '', 'modifydate': 1604578165.942433, 'createdate': 1604578165.942433, 'savedate': 0, 'syncdate': 0, 'tags': []}
Traceback (most recent call last):
  File ".\validate.py", line 18, in <module>
    assert 'key' in obj and type(obj['key']) == str
AssertionError


Done.  Some notes are broken :-(
See above log for details.
  1. I played around a bit with the script, and key is actually not in the object for the newly saved notes. I decided to remove all the notes again, and copied over one of my linux notes. I had to transform createdate and modifydate to numbers instead of strings, but then the validation passed. So then I opened nvpy again, the window is still there, but in the powershell it gives the same slice indices TypeError that I mentioned above, and then drops into pdb. There are no notes visible in the nvpy window, and if I try to do anything, it's not responding.

RosanneZe avatar Nov 06 '20 11:11 RosanneZe

I prepared the test environment and tried to reproduce this issue. But I found no issue. Could you tell me more detailed info?

  1. Did you still have problems even if reinstalling the Python?
  2. Is it work if you use the simplest configuration like this:
[nvpy]
simplenote_sync = 0
  1. Please tell me the contents of nvpy.cfg file.
  2. Can you take a dump about local variables when it crashes?

yuuki0xff avatar Nov 08 '20 15:11 yuuki0xff

I started with the simple config file and then added in my settings one by one. The setting that crashes everything is layout = vertical. If I don't use that it works!

RosanneZe avatar Nov 10 '20 12:11 RosanneZe

Thank you for your reply. I'm happy to nvpy works on your PC :-) I rechecked in all test environments, but nvpy seems to work even if layout = vertical specified. If you want to continue the investigation, please take local variables dumps and tell it to me.

yuuki0xff avatar Nov 10 '20 14:11 yuuki0xff

I think it's the combination of layout = vertical and print_columns = 1. Without the print_columns = 1, I can actually use the vertical layout, so I can use nvpy just the way I want.

RosanneZe avatar Nov 12 '20 12:11 RosanneZe

Thanks, @RosanneZe ! I succeeded in reproducing this issue. I will fix it at a later date.

# reproduce-issue-215.ps1

set-content -path ~/nvpy.cfg -value '
[nvpy]
simplenote_sync = 0
layout = vertical
print_columns = 1
'

rm -Recurse ~/.nvpy
mkdir ~/.nvpy

set-content -path ~/.nvpy/empty.json -value '
{"content": "", "modifydate": 1, "createdate": 1, "savedate": 0, "syncdate": 0, "tags": []}
'

python3 -m nvpy
cat ~/.nvpy/nvpy.log

yuuki0xff avatar Nov 12 '20 12:11 yuuki0xff