Forums

Error while starting an always-on task

My Telegram bot runs successfully in console mode, but when I try to run it as an always-on task with the command python3.6 /home/yellowparrot/telegram/OCR_bot1.py, I get this error:

Nov 22 09:41:50 Traceback (most recent call last):
Nov 22 09:41:50   File "/home/yellowparrot/telegram/OCR_bot1.py", line 5, in <module>
Nov 22 09:41:50     import telepot
Nov 22 09:41:50   File "/home/yellowparrot/.local/lib/python3.6/site-packages/telepot/__init__.py", line 4, in <module>
Nov 22 09:41:50     import json
Nov 22 09:41:50   File "/usr/lib/python3.6/json/__init__.py", line 106, in <module>
Nov 22 09:41:50     from .decoder import JSONDecoder, JSONDecodeError
Nov 22 09:41:50   File "/usr/lib/python3.6/json/decoder.py", line 3, in <module>
Nov 22 09:41:50     import re
Nov 22 09:41:50   File "/usr/lib/python3.6/re.py", line 142, in <module>
Nov 22 09:41:50     class RegexFlag(enum.IntFlag):
Nov 22 09:41:50 AttributeError: module 'enum' has no attribute 'IntFlag'

What's the problem with importing the standard re module?

Did you create a file or install a library called enum yourself that may have been imported before the standard library enum?) eg: check in your ~/.local/lib/python3.6/site-packages for anything you installed.

Thank you, Conrad! I have found this enum (probably installed by some other module) and deleted, and now everything works.

Excellent, thanks for confirming!