openpreserve / fido

Format Identification for Digital Objects (FIDO) is a Python command-line tool to identify the file formats of digital objects. It is designed for simple integration into automated work-flows.
http://openpreservation.org/technology/products/fido/
Other
148 stars 47 forks source link

Migrate from 1.4.1 to 1.6.1 : FileNotFoundError: [Errno 2] No such file or directory: '.../fido/conf/formats-v104.xml' #213

Closed pulse-mind closed 2 months ago

pulse-mind commented 1 year ago

Hello,

I am using django and I migrate from 1.4.1 to 1.6.0. I have this error :

FileNotFoundError: [Errno 2] No such file or directory: '/Users/pmind/.virtualenvs/myproject/lib/python3.10/site-packages/fido/conf/formats-v104.xml'

In https://github.com/openpreserve/fido/tree/master/fido/conf there is only formats-v109.xml

Would you like to help me about that please ?

Best regards, Fred

carlwilson commented 1 year ago

Hi @pulse-mind, sorry to hear you have issues. Could you try issuing this command and see what happens please?

fido -sigs update

I'll look into what might be a packaging issue in the coming two weeks.

pulse-mind commented 1 year ago

Hi @carlwilson , thank you for your reply. I'am not sure to understand properly your request. So this is what I've done :

carlwilson commented 1 year ago

Hi @pulse-mind , it's not clear to me that you are running v1.6 of Fido which I suspect is the problem. Here's the output from a fresh virtualenv install on my workstation:

fido -v
zsh: correct 'fido' to 'id' [nyae]? n
FIDO v1.6.1 (formats-v109.xml, container-signature-20200121.xml, format_extensions.xml)
❯ fido -h
usage: fido [-h] [-v] [-q] [-recurse] [-zip] [-noextension] [-nocontainer] [-pronom_only] [-input INPUT] [-filename FILENAME] [-useformats INCLUDEPUIDS] [-nouseformats EXCLUDEPUIDS]
            [-matchprintf FORMATSTRING] [-nomatchprintf FORMATSTRING] [-bufsize BUFSIZE] [-sigs SIG_ACT] [-container_bufsize CONTAINER_BUFSIZE] [-loadformats XML1,...,XMLn]
            [-confdir CONFDIR]
            [FILE ...]

Note the -sigs option in the help output. Please just try a fido -v and check/paste the output please.

pulse-mind commented 1 year ago

Hi @carlwilson Thank you for your reply and the time spent on it.

I start with a fresh virtualenv using 1.4.1 and then running the install requirements with 1.6.0 and this is the output (I probably did not take care about last time):

WARNING: The candidate selected for download or install is a yanked version: 'opf-fido' candidate (version 1.6.0 at https://files.pythonhosted.org/packages/7f/2e/77ea6a904ea150159a0afdf7f36246d20f488b2b7ad54a2915e435b0751c/opf_fido-1.6.0-py2.py3-none-any.whl (from https://pypi.org/simple/opf-fido/))
Reason for being yanked: Incorrect packaging
Installing collected packages: importlib-resources, opf-fido
  Attempting uninstall: opf-fido
    Found existing installation: opf-fido 1.4.1
    Uninstalling opf-fido-1.4.1:
      Successfully uninstalled opf-fido-1.4.1
Successfully installed importlib-resources-5.12.0 opf-fido-1.6.0

I never had this kind of warning in the past. If I do a pip listI have opf-fido 1.6.0

And now if I do fido -v :

(myproject) ➜ myproject git:(master) ✗ fido -v
FIDO v1.6.0 (formats-v109.xml, container-signature-20200121.xml, format_extensions.xml)

And then ```fido -h````

fido -h
usage: fido [-h] [-v] [-q] [-recurse] [-zip] [-noextension] [-nocontainer] [-pronom_only] [-input INPUT] [-filename FILENAME]
            [-useformats INCLUDEPUIDS] [-nouseformats EXCLUDEPUIDS] [-matchprintf FORMATSTRING] [-nomatchprintf FORMATSTRING] [-bufsize BUFSIZE]
            [-sigs SIG_ACT] [-container_bufsize CONTAINER_BUFSIZE] [-loadformats XML1,...,XMLn] [-confdir CONFDIR]
            [FILE ...]

And finally fido -sigs update that was not working last time which is working now...

fido -sigs update
Your signature files are up to date, current version is v109

At the end I still have the same Error

FileNotFoundError: [Errno 2] No such file or directory: '/Users/pmind/.virtualenvs/myproject/lib/python3.10/site-packages/fido/conf/formats-v104.xml'
carlwilson commented 1 year ago

Thanks for that detailed feedback. That's enough for me to do a little more investigation. It will be next week when I get back to you with some progress hopefully.

pulse-mind commented 1 year ago

Hi @carlwilson did you find the time to investigate ?

carlwilson commented 1 year ago

Hi @pulse-mind, apologies for the time taken. Could you please let me know your Python and Pip versions please?

❯ python --version
Python 3.11.3
❯ pip --version
pip 23.1.2 from .venvs/fido/lib/python3.11/site-packages/pip (python 3.11)
pulse-mind commented 1 year ago

Hello,

At this day :

> python --version
Python 3.10.4
> pip --version
pip 23.1.2 from /Users/.../.virtualenvs/.../lib/python3.10/site-packages/pip (python 3.10)

I think it was the same few weeks or month ago except minor version.

pulse-mind commented 1 year ago

Hi @carlwilson

Did you find the time to investigate ?

Have a good day. Fred

pulse-mind commented 6 months ago

Hi @carlwilson , Any chance for an investigation on this issue ?

pulse-mind commented 5 months ago

@carlwilson In fido.py, the defaults contains v104 instead of v109

defaults = {
    'bufsize': 128 * 1024,  # (bytes)
    'regexcachesize': 2084,  # (bytes)
    'printmatch': "OK,%(info.time)s,%(info.puid)s,\"%(info.formatname)s\",\"%(info.signaturename)s\",%(info.filesize)s,\"%(info.filename)s\",\"%(info.mimetype)s\",\"%(info.matchtype)s\"\n",
    'printnomatch': "KO,%(info.time)s,,,,%(info.filesize)s,\"%(info.filename)s\",,\"%(info.matchtype)s\"\n",
    'format_files': [
        'formats-v104.xml',
        'format_extensions.xml'
    ],

Instead of

defaults = {
    'bufsize': 128 * 1024,  # (bytes)
    'regexcachesize': 2084,  # (bytes)
    'printmatch': "OK,%(info.time)s,%(info.puid)s,\"%(info.formatname)s\",\"%(info.signaturename)s\",%(info.filesize)s,\"%(info.filename)s\",\"%(info.mimetype)s\",\"%(info.matchtype)s\"\n",
    'printnomatch': "KO,%(info.time)s,,,,%(info.filesize)s,\"%(info.filename)s\",,\"%(info.matchtype)s\"\n",
    'format_files': [
        'formats-v109.xml',
        'format_extensions.xml'
    ],

If I modify this it works fine.

Do you want me to do a pull request for this ?

carlwilson commented 2 months ago

I've merged this at last @pulse-mind apologies, I've been stretched too thin over too many things and somethings had to give. We will endeavour to get a release out soon.

pulse-mind commented 2 months ago

Thank you, have a good day.