getfilenuitkapython


Namegetfilenuitkapython JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/getfilenuitkapython
SummaryA function that locates files in python environments and compiled exe files (Nuitka)
upload_time2023-05-08 05:13:21
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords nuitka locate files
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A function that locates files in python environments and compiled exe files (Nuitka)

## [ nuitka ](https://nuitka.net/doc/download.html) is certainly the best py2exe- compiler, but it is not always easy to include additional files. 

The first time I tried that, the compiled EXE wasn't able to find the included files, and it took me some time to make all the necessary code adjustments.  This is why I wrote a little function that locates files in the most likely locations (python env/nuikta exe).

## pip install getfilenuitkapython 

This module contains a function called get_filepath which returns the full path to a file, given its filename. It uses the os and sys modules to search for the file in multiple locations.

```python
Parameters
----------
filename: A string representing the name of the file to locate.

Returns
----------
A string representing the full path to the file, if it is found.
If the file is not found in any of the locations, the function returns the filename itself.

Description
----------
The get_filepath function searches for the file in the following locations:

1. The directory containing the script that was invoked from the command line.
2. The directory containing the current module file (__file__).
3. The parent directory of the directory containing the script that was invoked from the command line.
4. The parent directory of the directory containing the current module file (__file__).
5. The directory containing the calling function (sys._getframe(1)).
6. The parent directory of the directory containing the calling function.
7. Search in PATH
8. Search in every folder in basedirs 

If the file is found in any of these locations, the function returns the full path to the file. If the file is not found in any of these locations, the function returns the filename itself.


from getfilenuitkapython import get_filepath
get_filepath('pythonw.exe')
Out[3]: 'C:\\ProgramData\\anaconda3\\envs\\dfdir\\pythonw.exe'
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/getfilenuitkapython",
    "name": "getfilenuitkapython",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "nuitka,locate,files",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2c/8b/0eceb1082ecf8417ca880df229c868f632e522383b7eeadff5279b75adb5/getfilenuitkapython-0.11.tar.gz",
    "platform": null,
    "description": "# A function that locates files in python environments and compiled exe files (Nuitka)\r\n\r\n## [ nuitka ](https://nuitka.net/doc/download.html) is certainly the best py2exe- compiler, but it is not always easy to include additional files.\u00c2\u00a0\r\n\r\nThe first time I tried that, the compiled EXE wasn't able to find the included files, and it took me some time to make all the necessary code adjustments.\u00c2\u00a0 This is why I wrote a little function that locates files in the most\u00c2\u00a0likely locations (python env/nuikta exe).\r\n\r\n## pip install getfilenuitkapython \r\n\r\nThis module contains a function called get_filepath which returns the full path to a file, given its filename. It uses the os and sys modules to search for the file in multiple locations.\r\n\r\n```python\r\nParameters\r\n----------\r\nfilename: A string representing the name of the file to locate.\r\n\r\nReturns\r\n----------\r\nA string representing the full path to the file, if it is found.\r\nIf the file is not found in any of the locations, the function returns the filename itself.\r\n\r\nDescription\r\n----------\r\nThe get_filepath function searches for the file in the following locations:\r\n\r\n1. The directory containing the script that was invoked from the command line.\r\n2. The directory containing the current module file (__file__).\r\n3. The parent directory of the directory containing the script that was invoked from the command line.\r\n4. The parent directory of the directory containing the current module file (__file__).\r\n5. The directory containing the calling function (sys._getframe(1)).\r\n6. The parent directory of the directory containing the calling function.\r\n7. Search in PATH\r\n8. Search in every folder in basedirs \r\n\r\nIf the file is found in any of these locations, the function returns the full path to the file. If the file is not found in any of these locations, the function returns the filename itself.\r\n\r\n\r\nfrom getfilenuitkapython import get_filepath\r\nget_filepath('pythonw.exe')\r\nOut[3]: 'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\pythonw.exe'\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A function that locates files in python environments and compiled exe files (Nuitka)",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/getfilenuitkapython"
    },
    "split_keywords": [
        "nuitka",
        "locate",
        "files"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86767fe9320d03af1cc6f178228ca18cb56503634fdfc10c189e67f0c6f98516",
                "md5": "1b65595fde8c69413e54a01923b121c1",
                "sha256": "e4bf84dbc078e4f868d44a798165656611b2445f22d746f5ed22fb95ea4517d0"
            },
            "downloads": -1,
            "filename": "getfilenuitkapython-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1b65595fde8c69413e54a01923b121c1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5977,
            "upload_time": "2023-05-08T05:13:19",
            "upload_time_iso_8601": "2023-05-08T05:13:19.924140Z",
            "url": "https://files.pythonhosted.org/packages/86/76/7fe9320d03af1cc6f178228ca18cb56503634fdfc10c189e67f0c6f98516/getfilenuitkapython-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c8b0eceb1082ecf8417ca880df229c868f632e522383b7eeadff5279b75adb5",
                "md5": "391f138f72aed44b7f2ef2c93df372ed",
                "sha256": "2b6add986a3f371a16c40e1584379092acd0227f2d7e00227afab9717698618a"
            },
            "downloads": -1,
            "filename": "getfilenuitkapython-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "391f138f72aed44b7f2ef2c93df372ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4076,
            "upload_time": "2023-05-08T05:13:21",
            "upload_time_iso_8601": "2023-05-08T05:13:21.631040Z",
            "url": "https://files.pythonhosted.org/packages/2c/8b/0eceb1082ecf8417ca880df229c868f632e522383b7eeadff5279b75adb5/getfilenuitkapython-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 05:13:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "getfilenuitkapython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "getfilenuitkapython"
}
        
Elapsed time: 0.09188s