Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when running the script #15

Open
pablo-gbr opened this issue Jul 3, 2024 · 2 comments
Open

Issue when running the script #15

pablo-gbr opened this issue Jul 3, 2024 · 2 comments

Comments

@pablo-gbr
Copy link
Contributor

I'm running this package on an Apache server, but every time I run any of the scripts, it gives me a Syntax Error at the try-except block.

It seems that when passing the script to the process, it runs it in a single line, causing the conflict since python can't handle a try-except block in a single line.

To test it, I removed the try-except block from a script, by doing this I get ProcessFailedException whenever the script raises a ValueError exception. I can catch it inside the run() function and parse the ValueError message to throw a DeepFaceException if necessary.

I would like some feedback, in order to submit a new MR to address this.

@Gummibeer
Copy link
Member

Yeah, the script method replaces all linebreaks with a whitespace. I'm not sure if python can execute a multiline string from CLI or if it would have to be a file? 🤔

@pablo-gbr
Copy link
Contributor Author

I removed the try block from one of the scripts and running it in powershell with python -c "script code here" and it worked, seems that python doesn't like a try block in a single line.

And I came up that the str_replace(PHP_EOL in the script() function didn't replace \r characters somehow, replacing it with a preg_replace fixed it.

I'm getting all of this trying to run the package on an Apache server, I don't know if anyone came up with the same problems, and in case of submitting a new PR, it should not break any existing projects that depends on this (hopefully).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants