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

Unable to find file #35

Open
attiquetecnologia opened this issue May 31, 2022 · 0 comments
Open

Unable to find file #35

attiquetecnologia opened this issue May 31, 2022 · 0 comments

Comments

@attiquetecnologia
Copy link

attiquetecnologia commented May 31, 2022

Hello, I try deploy my code on python anywhere, but I using the flask with he.
On my PC de app its runngin but when to do deploy I catch this error.

RuntimeError
2022-05-31 12:54:46,792: Exception on / [GET]
Traceback (most recent call last):
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/attiquetecnologia/agridecision/default/controller.py", line 55, in index
    return render(filename=os.path.join(
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 958, in render
    code = str(TemplateParser(text=content,
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 334, in __init__
    self.parse(text)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 781, in parse
    self.extend(extend)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 495, in extend
    text = self._get_file_text(filename) or '%sinclude%s' % tuple(self.delimiters)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 467, in _get_file_text
    text = self.reader(filepath)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 45, in file_reader
    with open(filename, mode) as fp:
TypeError: expected str, bytes or os.PathLike object, not builtin_function_or_method
2022-05-31 12:55:53,821: <built-in function abs>::Unable to find the file
2022-05-31 12:55:53,822: Exception on / [GET]
Traceback (most recent call last):
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 45, in file_reader
    with open(filename, mode) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '<built-in function abs>'
**NO MATCH**
During handling of the above exception, another exception occurred:
**NO MATCH**
Traceback (most recent call last):
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/attiquetecnologia/agridecision/default/controller.py", line 55, in index
    return render(filename=os.path.join(
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 958, in render
    code = str(TemplateParser(text=content,
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 334, in __init__
    self.parse(text)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 781, in parse
    self.extend(extend)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 495, in extend
    text = self._get_file_text(filename) or '%sinclude%s' % tuple(self.delimiters)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 467, in _get_file_text
    text = self.reader(filepath)
  File "/home/attiquetecnologia/.virtualenvs/agridecision/lib/python3.9/site-packages/yatl/template.py", line 49, in file_reader
    raise RestrictedError(filename, '', 'Unable to find the file')
RuntimeError

All relative paths not found on my code.

Exemple.

dashboard/controller.py

@bp.route("/default/edit/<int:id>")
def edit(id=None):
    if not id:
        return "Error! Id not found!"

    from models.utils import estados
    # db = get_db()
    default = db(defaultModel.id==id).select().first()

    return render(
        filename="default/views/form.html"
            , context=dict(default=default, estados=estados)
    )

dashboard/views/form.html

{{ extend "dashboard/views/layout.html"}}

<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
....

To this run on server it is need absoluted paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant