Skip to content

Import *.gz files: UnboundLocalError: local variable 'file' referenced before assignment #287

@Prinzhorn

Description

@Prinzhorn

From what I understand the script should automatically detect and unzip these? It doesn't like my *.gz Apache logs. Can be reproduced with an empty gzipped file (literally gzip empty with a 0 byte empty file).

python3 import_logs.py \
  --dry-run \
  --url='http://localhost:8080' \
  --token-auth=1234 \
  --idsite=1 \
  empty.gz
Parsing log empty.gz...
Traceback (most recent call last):
  File "import_logs.py", line 2674, in <module>
    main()
  File "import_logs.py", line 2640, in main
    parser.parse(filename)
  File "import_logs.py", line 2378, in parse
    data = file.read(100)
UnboundLocalError: local variable 'file' referenced before assignment

Edit: I also had to apply #281 before the script even ran

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions