1

I am using Liquibase (http://www.liquibase.org) to try and diff two databases. Liquibase is installed and running fine from CLI, however when I try to fun the same command from Python 3.7 using subprocess and shlex i can FileNotFoundError: [Errno 2] No such file or directory: 'liquibase': 'liquibase'

When I add subprocess.call('pwd') to Python script, I get the same directory as when I am executing the command from terminal. Liquibase install directory is added to my system path when do I echo $PATH, my understanding is that both the CLI and the Python execution are using the same environment. So I don't understand what is the difference in execution?

UPDATE: this seems to be an issue related to PyCharm. I tried executing from VS Code and there were no errors. I am using PyCharm Professional. Does anyone have an idea of what is wrong with my setting in PyCharm?

kravb
  • 417
  • 4
  • 16

1 Answers1

0

PyCharm may be using its own shell and so its PATH environment variable may not contain a path to liquidbase binary. Try this.

Ali Atiia
  • 139
  • 7
  • Hi, this is already true "liquibase" works from command line. Also if I execute the python script from command line, then there are no error. This is most likely a problem with how PyCharm works and/or sets up working directories as this problem only happens when executing script from within PyCharm. But I am having no luck in figuring out a solution. – kravb Jan 08 '20 at 22:50
  • @kravb looks like a shell issue, please take a look at the linked answer in my edited answer – Ali Atiia Jan 08 '20 at 22:56