Uploaded image for project: 'Hue (READ ONLY)'
  1. Hue (READ ONLY)
  2. HUE-9476

[importer] Indexer file format guess API call errors with Python 3

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.7.0
    • Fix Version/s: None
    • Component/s: api
    • Labels:
      None

      Description

      e.g. Go to the Importer and select a file in input:

      [24/Aug/2020 22:31:23 -0700] decorators   ERROR    Error running guess_format
      Traceback (most recent call last):
        File "/home/romain/projects/hue/desktop/libs/notebook/src/notebook/decorators.py", line 119, in wrapper
          return f(*args, **kwargs)
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/api3.py", line 121, in guess_format
          format_ = indexer.guess_format({
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/indexers/morphline.py", line 125, in guess_format
          file_format = get_file_format_instance(data['file'])
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/file_format.py", line 91, in get_file_format_instance
          return (matches[0] if matches else get_format_types()[0]).get_instance(file_stream, format_)
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/file_format.py", line 493, in get_instance
          return cls._guess_from_file_stream(file_stream)
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/file_format.py", line 445, in _guess_from_file_stream
          for sample_data, sample_lines in cls._get_sample(file_stream):
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/file_format.py", line 437, in _get_sample
          sample_data, sample_lines = reader.readlines(file_stream, encoding)
        File "/home/romain/projects/hue/desktop/libs/indexer/src/indexer/file_format.py", line 624, in readlines
          return data, itertools.islice(csv.reader(string_io(data)), IMPORT_PEEK_NLINES)
      TypeError: initial_value must be str or None, not bytes
      [24/Aug/2020 22:31:23 -0700] access       INFO     127.0.0.1 romain@gethue.com - "POST /indexer/api/indexer/guess_format HTTP/1.1" returned in 5036ms 200 73 (mem: 164mb)
      

       

        Attachments

          Activity

            People

            • Assignee:
              ayush.goyal Ayush Kumar Goyal
              Reporter:
              ayush.goyal Ayush Kumar Goyal
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: