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

FileNotFoundError in running_in_docker #1201

Closed
hassa opened this issue Dec 1, 2022 · 5 comments
Closed

FileNotFoundError in running_in_docker #1201

hassa opened this issue Dec 1, 2022 · 5 comments
Labels
bug Something isn't working has-pr

Comments

@hassa
Copy link

hassa commented Dec 1, 2022

Context

In running_in_docker if there is no /proc/1/cgroup, like on OSX for example, a FileNotFoundError is raised and zappa can't be imported.

We do some stuff with SQS and zappa's asynchronous tasks so we import zappa even during dev.

Expected Behavior

FileNotFoundError should be caught and running_in_docker should return False.

Actual Behavior

A FileNotFoundError is raised.

Possible Fix

FileNotFoundError should be caught and running_in_docker should return False.

Steps to Reproduce

  1. Be on OSX
  2. import zappa

Your Environment

  • Zappa version used: 0.56.0
  • Operating System and Python version: OSX 12.6, Python 3.9 and 3.11.0
  • The output of pip freeze:
  • Link to your project (optional):
  • Your zappa_settings.json:
@rogerhoward
Copy link

Having the same issue, but triggered by "zappa init" even; eg:

  1. create a virtualenv and activate it
  2. install zappa ("pip install zappa")
  3. run "zappa init"

@monkut
Copy link
Collaborator

monkut commented Dec 1, 2022

Thanks for reporting this, we'll get a fix out soon!

@pkaufhol
Copy link

pkaufhol commented Dec 2, 2022

Same issue on osx!

monkut added a commit that referenced this issue Dec 3, 2022
* Update setup.py

* Update __init__.py

* 🐛 fix FileNotFoundError in running_in_docker (#1201)

* Remove version constraints

* Changed the way Docker is determined

* Reference to ticket 1140

* Added documentation for ZAPPA_RUNNING_IN_DOCKER flag

* Fixed indentation

* Removed log file

* Added strtobool and re-added MINIMUM_SUPPORTED_MIINOR_VERSION

* updated version

* Added #1201 to CHANGELOG.md, reformatted code

* Reformatted by black due to line length

* Removed unnecessary comment

Co-authored-by: monkut <shane.cousins@gmail.com>
@monkut
Copy link
Collaborator

monkut commented Dec 3, 2022

Method was changed, and fixed in the 0.56.1 release, please check.

@hassa
Copy link
Author

hassa commented Dec 5, 2022

@monkut it works now, thank you for the quick turnaround!

@hassa hassa closed this as completed Dec 5, 2022
Ian288 pushed a commit to tackle-io/Zappa that referenced this issue Jul 11, 2023
* Update setup.py

* Update __init__.py

* 🐛 fix FileNotFoundError in running_in_docker (zappa#1201)

* Remove version constraints

* Changed the way Docker is determined

* Reference to ticket 1140

* Added documentation for ZAPPA_RUNNING_IN_DOCKER flag

* Fixed indentation

* Removed log file

* Added strtobool and re-added MINIMUM_SUPPORTED_MIINOR_VERSION

* updated version

* Added zappa#1201 to CHANGELOG.md, reformatted code

* Reformatted by black due to line length

* Removed unnecessary comment

Co-authored-by: monkut <shane.cousins@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has-pr
Projects
None yet
Development

No branches or pull requests

4 participants