Python language 3.7.3 : Filenotfounderror: [Errno 2] . .

Asked

Viewed 100 times

0

Good morning.

I have the following code in a class that works perfectly well when I print inside it. Now when access through another class file presents me error. Below demonstrate class that works :

import os 
class WspApplication:

ws_listdir = os.listdir('../application/controllers')

This class works when I print inside it.

It only shows the error below when I try to access it in another class:

ws_listdir = os.listdir('../application/controllers') Filenotfounderror: [Errno 2] No such file or directory: '.. /application/controllers'

Below follows the other class :

from syscore.wsp_application import WspApplication
class WspProtected:

def wsm_dir(ws_path):

    ws_root = WspApplication.ws_listdir
    if ws_path == ws_root:
        return 'Info. . .'.encode('utf-8')

You can disregard the path parameter in the analysis it works !

  • these two classes are in the same directory and/or have the same access permissions?

  • yes and are without permissions.

  • ../application/controllers this location is right? ta in project folder?

  • Yes, the classes are in the same directory already the path ( ../ application / controllers ) that I want to access are in another directory as above, but in the same root.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.