selva221724 / pypostalwin

libpostal wrapper python package for windows
MIT License
14 stars 5 forks source link

FileNotFoundError: [WinError 2] The system cannot find the file specifie` #3

Closed selva221724 closed 2 years ago

selva221724 commented 2 years ago

If you get this error

import sys; print('Python %s on %s' % (sys.version, sys.platform))
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.28.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.28.0
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] on win32
runfile('C:/***/stack.py', wdir='C:/***/Desktop')
Traceback (most recent call last):
  File "C:\Users\***\Anaconda3\envs\er_plugin\lib\site-packages\IPython\core\interactiveshell.py", line 3444, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-74d7919c61fb>", line 1, in <module>
    runfile('C:/Users/***/Desktop/stack.py', wdir='C:/Users/***/Desktop')
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/***/Desktop/stack.py", line 3, in <module>
    parser = pypostalwin.AddressParser()
  File "C:\Users\***\Anaconda3\envs\er_plugin\lib\site-packages\pypostalwin.py", line 42, in __init__
    self.process = Popen(self.exePath, shell=False, universal_newlines=True,
  File "C:\Users\***\Anaconda3\envs\er_plugin\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\***\Anaconda3\envs\er_plugin\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

I am attaching the answer below

selva221724 commented 2 years ago

This is due to the pypostalwin is not able to find the bundled package from ' C:\Workbench\libpostal`. Please make sure you unzipped the bundle in the correct location.