flirpy icon indicating copy to clipboard operation
flirpy copied to clipboard

Update seq class name

Open maasencioh opened this issue 3 years ago • 9 comments

I was trying to convert a SEQ file to TIFF, and I had the following error:

INFO:__main__:Loading: cDdG_1.0b_0001.SEQ
Traceback (most recent call last):
  File "/<dir>/flirpy/scripts/split_seqs", line 100, in <module>
    splitter = flirpy.io.seq.splitter(output_folder,
AttributeError: module 'flirpy.io.seq' has no attribute 'splitter'

I did the following:

  • run autopep8 over the file
  • update flirpy.io.seq.Splitter name (was in lower case)
  • remove width and height options for splitter

Now I'm getting the following error

Traceback (most recent call last):
  File "<dir>/split_seqs", line 178, in <module>
    folders = splitter.process(files)
  File "/<dir>/flirpy/io/seq.py", line 148, in process
    self.exiftool.write_meta(filemask)
  File "/<dir>/flirpy/util/exiftool.py", line 75, in write_meta
    res = subprocess.call(cmd, cwd=cwd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/<dir>/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/<dir>/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/<dir>/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/<dir>/cDdG_1.0b_0001/raw'

maasencioh avatar Jan 29 '21 15:01 maasencioh

Thanks for updating this - however would you remind removing autopep8 please? I appreciate the formatting, but I would rather go through the entire codebase separately (and I would like to tune some of the options for personal preference).

jveitchmichaelis avatar Jan 30 '21 02:01 jveitchmichaelis

@jveitchmichaelis sure, but could you please help me meanwhile to understand the last problem?

maasencioh avatar Feb 01 '21 09:02 maasencioh

There are previous errors, but they are not related with this changes Screen Shot 2021-02-01 at 17 48 43

maasencioh avatar Feb 01 '21 16:02 maasencioh

I'm not sure about your path error without some more info - does that folder actually exist? What are you calling the script with to get that error?

In the boson/lepton code it looks like decode is called twice, you can get rid of the second one. I don't get any of those errors with no cameras connected using Python 3.7.9 - maybe it's something that got introduced with 3.8?

The issue with at least the Teax error in your test output is that you don't have libusb installed.

However I would prefer to keep PRs small/separated so if we can just update the splitter name and figure out why you get that path error, we can move these other issues to another PR.

jveitchmichaelis avatar Feb 04 '21 06:02 jveitchmichaelis

I can confirm that after correcting "splitter" case and removing width and height parameters, split_seqs works for me (Python 3.9 under Linux).

@maasencioh Did you change the real path into /<dir>/ when writing your comment here or is the literal <dir> shown in the actual error messages and stack traces?

acaso avatar Apr 29 '21 19:04 acaso

Hello @acaso here I replaced the real path with <dir>, I runned this with python 3.9 today and have the following error

Error
(py39) macbook@iMac-de-MacBook [17:26:21] [~/Documents/powerlab/thermal_images]
-> % python3 ~/github/flirpy/scripts/split_seqs -i cDdG_1.0b_0001.SEQ --export_tiff
/Users/macbook/github/flirpy/scripts/split_seqs:86: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if args.verbosity is not 'quiet':
/Users/macbook/github/flirpy/scripts/split_seqs:95: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if output_folder is not "./":
INFO:__main__:Loading: cDdG_1.0b_0001.SEQ
INFO:flirpy.io.seq:Splitting 1 files
  0%|                                                                                                                                                          | 0/1 [00:00<?, ?it/s]INFO:flirpy.io.seq:Splitting cDdG_1.0b_0001.SEQ into /Users/macbook/Documents/powerlab/thermal_images/cDdG_1.0b_0001
0it [00:00, ?it/s]
INFO:flirpy.io.seq:Extracting metadata
  0%|                                                                                                                                                          | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/macbook/github/flirpy/scripts/split_seqs", line 111, in <module>
    folders = splitter.process(files)
  File "/Users/macbook/anaconda3/envs/py39/lib/python3.9/site-packages/flirpy/io/seq.py", line 148, in process
    self.exiftool.write_meta(filemask)
  File "/Users/macbook/anaconda3/envs/py39/lib/python3.9/site-packages/flirpy/util/exiftool.py", line 75, in write_meta
    res = subprocess.call(cmd, cwd=cwd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/Users/macbook/anaconda3/envs/py39/lib/python3.9/subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/macbook/anaconda3/envs/py39/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/macbook/anaconda3/envs/py39/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/macbook/Documents/powerlab/thermal_images/cDdG_1.0b_0001/raw'

So what I did was to create a empty dir inside, but then it finishes without errors but without results

maasencioh avatar May 03 '21 15:05 maasencioh

Can you try renaming the directory without a period? It may be that exiftool is having trouble with it.

And this folder exists after you run the script? /Users/macbook/Documents/powerlab/thermal_images/cDdG_1.0b_0001/raw

jveitchmichaelis avatar May 07 '21 21:05 jveitchmichaelis

Hi, after renaming the file to test.seq I have the following error:

(base) macbook@iMac-de-MacBook [14:17:17] [~/Documents/powerlab/thermal_images]
-> % python3 ~/github/flirpy/scripts/split_seqs -i test.seq --export_tiff
/Users/macbook/github/flirpy/scripts/split_seqs:86: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if args.verbosity is not 'quiet':
/Users/macbook/github/flirpy/scripts/split_seqs:95: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if output_folder is not "./":
INFO:__main__:Loading: test.seq
INFO:flirpy.io.seq:Splitting 1 files
  0%|                                                                                                                                                          | 0/1 [00:00<?, ?it/s]INFO:flirpy.io.seq:Splitting test.seq into /Users/macbook/Documents/powerlab/thermal_images/test
0it [00:00, ?it/s]
INFO:flirpy.io.seq:Extracting metadata
  0%|                                                                                                                                                          | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/macbook/github/flirpy/scripts/split_seqs", line 111, in <module>
    folders = splitter.process(files)
  File "/Users/macbook/anaconda3/lib/python3.8/site-packages/flirpy/io/seq.py", line 148, in process
    self.exiftool.write_meta(filemask)
  File "/Users/macbook/anaconda3/lib/python3.8/site-packages/flirpy/util/exiftool.py", line 75, in write_meta
    res = subprocess.call(cmd, cwd=cwd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/Users/macbook/anaconda3/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/macbook/anaconda3/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/macbook/anaconda3/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/macbook/Documents/powerlab/thermal_images/test/raw'

I have no raw directory in the resulting directory.

If I roll back to the python 3.7 I still can't run it because I have the following error:

INFO:__main__:Loading: test.seq
INFO:flirpy.io.seq:Splitting 1 files
Traceback (most recent call last):
  File "/Users/macbook/github/flirpy/scripts/split_seqs", line 111, in <module>
    folders = splitter.process(files)
  File "/Users/macbook/anaconda3/envs/py37/lib/python3.7/site-packages/flirpy/io/seq.py", line 114, in process
    for seq in tqdm(file_list):
TypeError: 'module' object is not callable

maasencioh avatar Jun 08 '21 12:06 maasencioh

Ok I have no issues with this on my local development copy. I'll have a look when I get a chance.

If you're still having trouble, roll back to a previous version of Flirpy for now and see if that works.

jveitchmichaelis avatar Jun 08 '21 18:06 jveitchmichaelis