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

Unexpected behaviour after previewing failure #2492

Open
guillermogf opened this issue Nov 12, 2021 · 5 comments
Open

Unexpected behaviour after previewing failure #2492

guillermogf opened this issue Nov 12, 2021 · 5 comments
Labels
Milestone

Comments

@guillermogf
Copy link
Contributor

guillermogf commented Nov 12, 2021

Runtime Environment

Ranger and Python version:

ranger version: ranger 1.9.2
Python version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
Locale: es_ES.UTF-

Unoconv and LibreOffice version:

unoconv 0.7
Written by Dag Wieers <dag@wieers.com>
Homepage at http://dag.wieers.com/home-made/unoconv/

platform posix/linux
python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0]
LibreOffice 6.1.5.2

Using default scope.sh.

Running Debian Buster, everything installed from the official repositories.

Current Behavior

I have an OpenDocument spreadsheet (ods file) which odt2txt (i.e. unoconv), which is the previewer used by default in the scope.sh file, fails to convert to text format to offer as a preview. That's an issue on itself, unrelated to ranger, but not the point of this report.
The problem is that the failure is not handled properly by ranger. At least I don't think it is, but I may be wrong.

After moving to said file, thus triggering the preview function, ranger will keep trying to get it indefinitely (with the running task "animation" showing some action being done). However, moving to another file or even going to the task preview will freeze ranger until Ctrl-C is pressed, cancelling the preview process.

Also, while trying to get the preview there will be a running Libreoffice process that will stop ranger from being able to open the file succesfully. This is, again, not a ranger issue directly, but it may be a side effect of not being able to stop looking for a preview it cannot get.

Expected Behavior

Most importantly, ranger should not freeze after not being able to preview a file.

I do not know how ranger manages previews, but it seems it tries to get them indefinitely. Maybe it should stop trying to find a preview for a file once the process that was meant to get it fails or after a reasonable time.

Possible Solutions

From the user standpoint, I can think of several actions can stop the issue to appear:

  1. Removing from scope.sh the lines that preview the file formats causing the problem; or using working alternatives for such task.
  2. Set preview_fails to False to avoid previews altogether; whereas on the config file or while running ranger (there's also the shortcut zp).

Steps to reproduce

  1. Get ahold of a file unoconv fails to preview.
  2. While on ranger, with previews activated, move to that file to trigger the preview function.
  3. Move to another file or attempt any task such as viewing the task view to make ranger freeze.
  4. Un-freeze ranger pressing Ctrl-C which stops the preview task from running.

Traceback

There's no traceback, not even while on debug mode. In fact, it took me a while to find out what was going on and how to reproduce it.

@toonn
Copy link
Member

toonn commented Nov 13, 2021

Thanks for the report. I wonder why this happens with odt2txt specifically. What is the return code when you run it on that file from a terminal?

@toonn toonn added the bug label Nov 13, 2021
@toonn toonn added this to the v1.9.5 milestone Nov 13, 2021
@guillermogf
Copy link
Contributor Author

I can't say for sure it's specific to odt2txt, but I've just noticed the problem with one specific ods file.

Here's the output:

$ odt2txt file.ods
Traceback (most recent call last):
  File "/usr/bin/odt2txt", line 1030, in convert
    document.storeToURL(outputurl, tuple(outputprops) )
uno.IOException: SfxBaseModel::impl_store <file:///home/guille/Documentos/uni/2021-22/1C/horario.txt> failed: 0xc10(Error Area:Io Class:Write Code:16)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/odt2txt", line 1275, in <module>
    main()
  File "/usr/bin/odt2txt", line 1191, in main
    convertor.convert(inputfn)
  File "/usr/bin/odt2txt", line 1032, in convert
    raise UnoException("Unable to store document to %s (ErrCode %d)\n\nProperties: %s" % (outputurl, e.ErrCode, outputprops), None)
  File "/usr/lib/python3/dist-packages/uno.py", line 507, in _uno_struct__getattr__
    return getattr(self.__dict__["value"], name)
AttributeError: ErrCode

@toonn
Copy link
Member

toonn commented Nov 13, 2021

And what's the return code? Usually in $? right after you've executed the command.

@guillermogf
Copy link
Contributor Author

Ah, yes, sorry, didn't see that was what you were asking for. The return code is 1.

@toonn
Copy link
Member

toonn commented Nov 22, 2021

@rtng, whoops, this isn't the right issue for that screenshot after all.

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

No branches or pull requests

2 participants