zip_file_path = utils.zip_df(df, data_directory, file_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
line 22, in zip_df
rc = subprocess.call([‘7z’, ‘a’, ‘-p’ + pswd_zip, zip_file_path, ‘-mx9’, os.path.abspath(file_path)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python\Lib\subprocess.py”, line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\Python\Lib\subprocess.py”, line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “C:\Program Files\Python\Lib\subprocess.py”, line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Hello,
based on this error:
it could be that you are attempting to run a module (file) that is not in the same location as your active current working directory. If so, you may try the following:
import os
os.chdir('directory path here where your file is located')
For example, if your file is located here: C:\my_folder\my_subfolder\my_file
, then add the following code to change the current working directory to where your file is locates as shown here:
import os
os.chdir(r'C:\my_folder\my_subfolder\my_file')
Alternatively, instead of entering just the file name in your function call, include its path as well.
Hi Paul
Thanks for Support
I tried but still getting same error
Per Google
:
The FileNotFoundError: [WinError 2] The system cannot find the file specified error in Python arises when the program attempts to access a file that either does not exist at the specified path or the path itself is incorrect. This error is operating system-specific, with WinError 2 indicating it occurred on a Windows system.
Btw, did you include the file extension?
If 7z
on your PATH if so try 7z.exe
, does that work?
If 7z.exe is not on your PATH then use the full path to the program.
HI Barry Scott, Paul,
Thanks for support.
7z path issue i fixed now its working fine
Thanks for Support.