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

error: nothing to repeat at position 0 #66

Open
timdnewman opened this issue Mar 15, 2022 · 2 comments
Open

error: nothing to repeat at position 0 #66

timdnewman opened this issue Mar 15, 2022 · 2 comments

Comments

@timdnewman
Copy link

timdnewman commented Mar 15, 2022

Hi,

I'm trying to open a seq file using the following code:

import flirpy.io.seq as fs
img_split = fs.Splitter(output_folder='./output', width=320, height=246, exiftool_path='path/to/exif/exiftool.exe')
img_split.process(['./Ply4 - Constant Direction_Tape0004.SEQ'])

The first two lines are fine but when I try and process the final line I get the following error:


error Traceback (most recent call last)
Input In [6], in <cell line: 1>()
----> 1 img_split.process(['./Ply4 - Constant Direction_Tape0004.SEQ'])

File path\RHP\lib\site-packages\flirpy\io\seq.py:144, in Splitter.process(self, file_list)
141 Path(folder).mkdir(exist_ok=True)
143 logger.info("Splitting {} into {}".format(seq, folder))
--> 144 self._process_seq(seq, folder)
146 # Batch export meta data
147 if self.export_meta:

File path\RHP\lib\site-packages\flirpy\io\seq.py:197, in Splitter._process_seq(self, input_file, output_subfolder)
193 def _process_seq(self, input_file, output_subfolder):
195 logger.debug("Processing {}".format(input_file))
--> 197 for count, frame in enumerate(tqdm(Seq(input_file, self.height, self.width))):
199 if frame.meta is None:
200 self.frame_count += 1

File path\RHP\lib\site-packages\tqdm\std.py:1195, in tqdm.iter(self)
1192 time = self._time
1194 try:
-> 1195 for obj in iterable:
1196 yield obj
1197 # Update and possibly print the progressbar.
1198 # Note: does not call self.update(1) for speed optimisation.

File path\RHP\lib\site-packages\flirpy\io\seq.py:79, in Seq.getitem(self, index)
76 offset, chunksize = self.pos[index]
77 chunk = self.seq_blob[offset:offset+chunksize]
---> 79 return Fff(chunk, self.width, self.height)

File path\RHP\lib\site-packages\flirpy\io\fff.py:34, in Fff.init(self, data, width, height)
32 self.height = height
33 self.meta = {}
---> 34 self._find_data_offset_simple(width, height)
35 else:
36 try:

File path\RHP\lib\site-packages\flirpy\io\fff.py:91, in Fff._find_data_offset_simple(self, width, height)
86 def _find_data_offset_simple(self, width, height):
87 search = struct.pack("<H", width-1)
88 + b"\x00\x00"
89 + struct.pack("<H", height-1)
---> 91 valid = re.compile(search)
92 res = valid.search(self.data)
94 self.data_offset = res.end() + 14

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\re.py:252, in compile(pattern, flags)
250 def compile(pattern, flags=0):
251 "Compile a regular expression pattern, returning a Pattern object."
--> 252 return _compile(pattern, flags)

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\re.py:304, in _compile(pattern, flags)
302 if not sre_compile.isstring(pattern):
303 raise TypeError("first argument must be string or compiled pattern")
--> 304 p = sre_compile.compile(pattern, flags)
305 if not (flags & DEBUG):
306 if len(_cache) >= _MAXCACHE:
307 # Drop the oldest item

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\sre_compile.py:764, in compile(p, flags)
762 if isstring(p):
763 pattern = p
--> 764 p = sre_parse.parse(p, flags)
765 else:
766 pattern = None

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\sre_parse.py:948, in parse(str, flags, state)
945 state.str = str
947 try:
--> 948 p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
949 except Verbose:
950 # the VERBOSE flag was switched on inside the pattern. to be
951 # on the safe side, we'll parse the whole thing again...
952 state = State()

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\sre_parse.py:443, in _parse_sub(source, state, verbose, nested)
441 start = source.tell()
442 while True:
--> 443 itemsappend(_parse(source, state, verbose, nested + 1,
444 not nested and not items))
445 if not sourcematch("|"):
446 break

File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\sre_parse.py:668, in _parse(source, state, verbose, nested, first)
666 item = None
667 if not item or item[0][0] is AT:
--> 668 raise source.error("nothing to repeat",
669 source.tell() - here + len(this))
670 if item[0][0] in _REPEATCODES:
671 raise source.error("multiple repeat",
672 source.tell() - here + len(this))

error: nothing to repeat at position 0

exif tools tells me it is:
File Permissions : -rw-rw-rw-
File Type : SEQ
File Type Extension : seq
MIME Type : image/x-flir-seq
Creator Software : CAMCTRL
Camera Model : FLIR SC325
Raw Thermal Image Width : 320
Raw Thermal Image Height : 246
Raw Thermal Image Type : TIFF
Raw Thermal Image : (Binary data 157644 bytes, use -b option to extract)

(and a bunch of stuff I don't think is relevant)

Is this another case of the endiness biting me? This is the first thing I've done with a thermal camera so apologies if I've missed anything obvious.

Thanks,

Tim

@timdnewman
Copy link
Author

I've edited the paths for brevity.

I'm on windows.

@timdnewman
Copy link
Author

Sorry - I keep remembering questions I've seen you ask other people.

flirpy installed from pip and it is version '0.3.0'

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

No branches or pull requests

1 participant