JolleJolles / pirecorder

Controlled and automated image and video recording with the raspberry pi
https://jollejolles.github.io/pirecorder/
Apache License 2.0
43 stars 9 forks source link

TypeError due to Config file not found #36

Closed MahejabeenNidhi closed 2 years ago

MahejabeenNidhi commented 2 years ago

Hi @JolleJolles,

Thank you so much for building such a great package for biologists. I am facing the following issue when I attempting to call PiRecorder

>>> rec = pirecorder.PiRecorder()

11:38:53 [raspberrypi] - pirecorder 3.3.4 started!
===============================================
11:38:53 [raspberrypi] - Config file pirecorder.conf not found, new file created..
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/pirecorder/pirecorder.py", line 121, in __init__
    self.settings(recdir="pirecorder/recordings",subdirs=False,
  File "/usr/local/lib/python3.9/dist-packages/pirecorder/pirecorder.py", line 435, in settings
    if self.config.rec.maxres[0] != "(":
TypeError: 'NoneType' object is not subscriptable

I tried accessing a particular config file from the documentation with the same error.

>>> rec = pirecorder.PiRecorder(configfile = "irsettings.conf")

11:40:22 [raspberrypi] - pirecorder 3.3.4 started!
===============================================
11:40:22 [raspberrypi] - Config file irsettings.conf not found, new file created..
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/pirecorder/pirecorder.py", line 121, in __init__
    self.settings(recdir="pirecorder/recordings",subdirs=False,
  File "/usr/local/lib/python3.9/dist-packages/pirecorder/pirecorder.py", line 435, in settings
    if self.config.rec.maxres[0] != "(":
TypeError: 'NoneType' object is not subscriptable

Would greatly appreciate your insight

Information about my Raspberry 4 Model B

$ cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
JolleJolles commented 2 years ago

Thanks @MahejabeenNidhi for noticing and reporting this error. It is now fixed in v3.3.6.

Notice also that if you are wanting to access a particular config file you should include the directory. By default, files are placed in the pirecorder folder, so in that case use e.g. configfile = "pirecorder/irsettings.conf".