About 579,000 results
Open links in new tab
  1. How to get the path of a function in Python? - Stack Overflow

    Jun 4, 2018 · I want to obtain the file path of a function in Python. How to do it? For example,

  2. How should I write a Windows path in a Python string literal?

    Apr 9, 2023 · Path takes a path-like string and adjusts everything for the current OS, either Windows or Linux. For example, on Linux it would convert all backslashes to forward slashes, and on Windows it …

  3. python - Get function import path - Stack Overflow

    Sep 10, 2013 · python /foo/bar/baz/bla.py and within bla.py (which is thus being run as __main__) determine "what from or import statement could a different main script use to import this function …

  4. How do I get the path of the current executed file in Python?

    Is there a universal approach in Python, to find out the path to the file that is currently executing? path = os.path.abspath(os.path.dirname(sys.argv[0])) This does not work if you are running from another …

  5. python - Local Azure Function: Customer packages not in sys path. This ...

    Nov 14, 2023 · 10 This warning will usually appear when you develop and run azure function locally. If you look at the source code of Python worker for Azure Functions this logging is happening here.

  6. How to split a dos path into its components in Python

    I can't actually contribute a real answer to this one (as I came here hoping to find one myself), but to me the number of differing approaches and all the caveats mentioned is the surest indicator that …

  7. python - Importing files from different folder - Stack Overflow

    If you run it from your root folder (ie. application folder), you are probably fine with sys.path.append('.') then importing the module by using from app2.some_folder.some_file import your_function. …

  8. Python: How to make a pathlib Path function argument optional?

    Jul 14, 2023 · I pass a Path argument to a function: from pathlib import Path def my_function(my_path: Path): pass and I would like to make the argument optional. My first naive attempt doesn't work …

  9. How to get an absolute file path in Python - Stack Overflow

    Sep 9, 2008 · 1081 Given a path such as "mydir/myfile.txt", how do I find the file's absolute path in Python? E.g. on Windows, I might end up with:

  10. python - path.exists () is returning False - Stack Overflow

    If you read the Python documentation of os.path.exists (), it says that there are specific cases in which a file or folder exists but os.path.exists () returns false: Return True if path refers to an existing path or …