Skip to content Skip to sidebar Skip to footer

Laravel To Python Runtimeerror: Can't Determine Home Directory

In my Laravel (php) product we are calling the python script. While I run this script in command prompt it's working fine. But from Laravel controller it raised an error. Error O

Solution 1:

I was having the same problem as you do, I could solved it out by setting up the variable manually as the problem was that

os.environ['HOME']

was being none, which was causing the problem

So you can set it up manually with this code

os.environ['HOME'] = 'C:/Python'

Check that you are using "/" and not "\" when setting up, otherwise it will give you an error.

It solved my problem. I'm using Apache as well and calling a Python script and also make sure that your code has the path of python on the top of your script

#!C:\Python\python.exe

Solution 2:

in git-bash, cmder sys similar problem when calling python based shell need define missing vars by something like: export HOMEPATH="G:/"

Post a Comment for "Laravel To Python Runtimeerror: Can't Determine Home Directory"