Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to set current column for selected rows to incremental values and to bulk save all sheets #1339

Closed
aborruso opened this issue Mar 25, 2022 · 8 comments

Comments

@aborruso
Copy link
Contributor

aborruso commented Mar 25, 2022

Small description

Hi, I want to open and bulk save all the html tables I have here. All the tables have the same name, then I need to rename them using g+i, and then save them in bulk g+CTRL+s.

When I run g+i I have NameError: name 'setitem' is not defined.

If I change the name of the tables, in the saved HTML files, when I run g+CTRL+s, I have AttributeError: 'str' object has no attribute 'name'

I start from

 vd https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php --save-filetype=csv

Expected result

  • to have the tables renamed;
  • to be able to save the tables in multiple CSV files:

Actual result with screenshot
image

image

image

image

Steps to reproduce with sample data and a .vd
Please attach the commandlog (saved with Ctrl-D) to show the steps that led to the issue.
See here for more details.

sheet   col     row     longname        input   keystrokes      comment
global          null_value      set-option
global          save_filetype   set-option      csv
                        open-file       https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php      o
indexT                  select-rows             gs      select all rows
indexT  name            setcol-incr             gi      set current column for selected rows to incremental values

Additional context
Please include the version of VisiData: the latest dev saul.pw/VisiData v2.9dev

@aborruso aborruso added the bug label Mar 25, 2022
anjakefala added a commit that referenced this issue Apr 3, 2022
Only saving selectedRows, so the sheet names should be pulled from
there.

Not all IndexSheets carry their sub-sheets in their `source`.

Closes #1339
@frosencrantz
Copy link
Contributor

@aborruso This simple task uncovers multiple bugs in the code. Thanks for the report! Thank you @anjakefala for fixing them!

@aborruso
Copy link
Contributor Author

aborruso commented Apr 3, 2022

@aborruso This simple task uncovers multiple bugs in the code. Thanks for the report! Thank you @anjakefala for fixing them!

I'm very happy to be useful in some way. Thank you very much @anjakefala

I can't wait for the PR to be approved and test it :)

anjakefala added a commit that referenced this issue Apr 6, 2022
Only saving selectedRows, so the sheet names should be pulled from
there.

Not all IndexSheets carry their sub-sheets in their `source`.

Closes #1339
anjakefala added a commit that referenced this issue Apr 6, 2022
Only saving selectedRows, so the sheet names should be pulled from
there.

Not all IndexSheets carry their sub-sheets in their `source`.

Closes #1339
anjakefala added a commit that referenced this issue Apr 6, 2022
Only saving selectedRows, so the sheet names should be pulled from
there.

Not all IndexSheets carry their sub-sheets in their `source`.

Closes #1339
@anjakefala
Copy link
Collaborator

I think I fixed all of the issues that were rolled up in here! The fixes are on the develop branch, and will be part of the next release. =)

@aborruso
Copy link
Contributor Author

aborruso commented Apr 6, 2022

I think I fixed all of the issues that were rolled up in here! The fixes are on the develop branch, and will be part of the next release. =)

I have installed it running pip3 install --upgrade --no-warn-script-location git+https://github.com/saulpw/visidata.git@develop, but I have again NameError: name 'setitem' is not defined.

My vd file

sheet	col	row	longname	input	keystrokes	comment
global		null_value	set-option			
global		save_filetype	set-option	csv		
			open-file	https://lab24.ilsole24ore.com/ecosistema-urbano/indexT.php	o	
indexT			select-rows		gs	select all rows
indexT	name		setcol-incr		gi	set current column for selected rows to incremental values

Thank you @anjakefala

@anjakefala
Copy link
Collaborator

Sorry. =(

I am pretty sure this is again an issue where there is an older version of VisiData lying around that you need to find, and uninstall. I cannot reproduce. D=

@aborruso
Copy link
Contributor Author

aborruso commented Apr 6, 2022

I am pretty sure this is again an issue where there is an older version of VisiData lying around that you need to find, and uninstall. I cannot reproduce. D=

I have uninstalled and than installed it again: now it works.

Thank you again

@frosencrantz
Copy link
Contributor

@anjakefala thanks for your fixes!

Later I realized my comment above (#1339 (comment) ) about this being a simple task is a good reason for simple tests for these fixes. So that future refactors don't break this code. This didn't really come to me until after the fixes were committed.

It looks like this issue points out a problem with the Visidata tests, not all commands are tested. Bad references can exist in commands without notice. I wonder if it would be useful to use something like pyp (hauntsaninja/pyp#26) to find missing references as part of testing, so there would be a check for this basic class of problem. I think if tests reported this error, it might have helped prevent one of the issues. Maybe a job for the someday list.

+@saulpw

@saulpw
Copy link
Owner

saulpw commented May 1, 2022

We have https://github.com/saulpw/visidata/blob/stable/visidata/tests/test_commands.py, but they aren't working properly. We should fix this and catch a lot of trivial bugs. Thanks for the reminder, @frosencrantz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants