0x48piraj / rqmts

rqmts - Generate pip requirements.txt file for any project
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Handling custom module imports #20

Open knmn2000 opened 4 years ago

knmn2000 commented 4 years ago

rqmts stops upon spotting a custom module import.

LOGCAT : input : "import numpy as np import cv2 from mss import mss import time from getkeys import key_check import os"

Output

Some modules were not successfully imported, and it means either of the two things :
1. No such module(s) (just ignore this warning then)
2. Module(s) not found in your system. (pip install <module-name>)
There seems to be discrepancies in following module(s) :
1 getkeys
Quitting.
0x48piraj commented 4 years ago

INPUT

import numpy as np import cv2 from mss import mss import time from getkeys import key_check import os

The highlighted is a custom/relative import which causes error. Seems like the solution lies in detecting Relative imports in Python

References

  1. Relative imports for the billionth time