DanielLin1986 / Function-level-Vulnerability-Detection

A deep learning-based vulnerability detection framework
73 stars 23 forks source link

Error: TypeError: cannot unpack non-iterable NoneType object #3

Open manishamukherjee opened 4 years ago

manishamukherjee commented 4 years ago

Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "/home/mmukherj/Function-level-Vulnerability-Detection-master/src/helper.py", line 124, in exec total_list, total_list_id = self.loadData(self.paras.data_dir) File "/home/mmukherj/Function-level-Vulnerability-Detection-master/src/helper.py", line 94, in loadData total_list, total_list_id = getCFilesFromText(data_path) TypeError: cannot unpack non-iterable NoneType object

I am running keras 2.2.4 and Tensorflow 1.14.0

DanielLin1986 commented 4 years ago

Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "/home/mmukherj/Function-level-Vulnerability-Detection-master/src/helper.py", line 124, in exec total_list, total_list_id = self.loadData(self.paras.data_dir) File "/home/mmukherj/Function-level-Vulnerability-Detection-master/src/helper.py", line 94, in loadData total_list, total_list_id = getCFilesFromText(data_path) TypeError: cannot unpack non-iterable NoneType object

I am running keras 2.2.4 and Tensorflow 1.14.0

Hi there, I think the error message shows that the data_path is not specified. The data_path is the directory where the data (which is the source code) for training is. When running the code, please specify the path to your data using the following commend:

Python main.py --config path_to_your_config_file\config.yaml --data_dir **path_to_your_code**

aravinthk00 commented 2 years ago

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data\LibPNG\LibPNG\Vulnerable_functions\CVE-2018-14048.c --embedding ELMo Using TensorFlow backend. Traceback (most recent call last): File "main.py", line 33, in helper = Helper(config, paras) File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 123, in init super(Trainer, self).init(config,paras) File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 45, in init if not os.path.exists(self.paras.data_dir): os.makedirs(self.paras.data_dir) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) [Previous line repeated 5 more times] File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 223, in makedirs mkdir(name, mode) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '**C:'

how to fix this ?

DanielLin1986 commented 2 years ago

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data\LibPNG\LibPNG\Vulnerable_functions[CVE-2018-14048](https://github.com/advisories/GHSA-64xj-5wfx-5pjg).c --embedding ELMo Using TensorFlow backend. Traceback (most recent call last): File "main.py", line 33, in helper = Helper(config, paras) File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 123, in init super(Trainer, self).init(config,paras) File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 45, in init if not os.path.exists(self.paras.data_dir): os.makedirs(self.paras.data_dir) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 213, in makedirs makedirs(head, exist_ok=exist_ok) [Previous line repeated 5 more times] File "C:\Users\30863\Anaconda3\envs\myenv\lib\os.py", line 223, in makedirs mkdir(name, mode) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '**C:'

how to fix this ?

Hi there, please specify the directory instead of the path of a specific file. For example, please try: python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data --embedding elmo