# Makes a string file path compatible (Windows)
```python
# Tested with:
# Python 3.9.13
# Windows 10
$pip install windows-filepath
import sys
import pandas as pd
import inspect
from windows_filepath import make_filepath_windows_comp, allow_long_path_windows
# creating some random data
teststuff = [x + '.png' if ini % 2 == 0 else x for ini, x in enumerate(inspect.getsource(pd).splitlines())]
for _ in teststuff:
# doesn't check the length, you can change the windows settings by calling allow_long_path_windows()
# This will set the MAX_PATH to 32,767
fp = make_filepath_windows_comp(
filepath=_,
fillvalue="_", # replacement of any illegal char
reduce_fillvalue=True, # */<> (illegal chars) -> ____ (replacement) -> _ (reduced replacement)
remove_backslash_and_col=False, # important for multiple folders
spaceforbidden=True, # '\s' -> _
other_to_replace=(";", ",", "[", "]", "`", "="), # other chars you don't want in the file path
slash_to_backslash=True, # replaces / with \\ before doing all the other replacements
)
print(_)
print(fp, end='\n\n')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/windows_filepath",
"name": "windows-filepath",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "file path,windows",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/8e/00/09abfe7bc94963c842a39cb098f95daa27072f79c27c4987fc9d2ed2bd56/windows_filepath-0.10.tar.gz",
"platform": null,
"description": "\n# Makes a string file path compatible (Windows)\n\n\n```python\n# Tested with:\n# Python 3.9.13\n# Windows 10\n\n\n$pip install windows-filepath\n\n\n\nimport sys\nimport pandas as pd\nimport inspect \nfrom windows_filepath import make_filepath_windows_comp, allow_long_path_windows\n# creating some random data \nteststuff = [x + '.png' if ini % 2 == 0 else x for ini, x in enumerate(inspect.getsource(pd).splitlines())]\nfor _ in teststuff:\n # doesn't check the length, you can change the windows settings by calling allow_long_path_windows()\n # This will set the MAX_PATH to 32,767\n fp = make_filepath_windows_comp(\n filepath=_,\n fillvalue=\"_\", # replacement of any illegal char\n reduce_fillvalue=True, # */<> (illegal chars) -> ____ (replacement) -> _ (reduced replacement)\n remove_backslash_and_col=False, # important for multiple folders\n spaceforbidden=True, # '\\s' -> _ \n other_to_replace=(\";\", \",\", \"[\", \"]\", \"`\", \"=\"), # other chars you don't want in the file path\n slash_to_backslash=True, # replaces / with \\\\ before doing all the other replacements \n)\n print(_)\n print(fp, end='\\n\\n')\n\n\n\t\n```\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Makes a string file path compatible (Windows)",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/windows_filepath"
},
"split_keywords": [
"file path",
"windows"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca34b445d7c4343ad6d9b04d4e66ae73916d444f948c8cffd67fd43fcfab06bd",
"md5": "1e8f253eef86fe74731b34fc46801b6c",
"sha256": "ae1a9e640ecaee1fad9e6b7e82c1a251cf9809e0243d21e973a2cc883702fc3e"
},
"downloads": -1,
"filename": "windows_filepath-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e8f253eef86fe74731b34fc46801b6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6177,
"upload_time": "2023-01-03T02:37:41",
"upload_time_iso_8601": "2023-01-03T02:37:41.105699Z",
"url": "https://files.pythonhosted.org/packages/ca/34/b445d7c4343ad6d9b04d4e66ae73916d444f948c8cffd67fd43fcfab06bd/windows_filepath-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e0009abfe7bc94963c842a39cb098f95daa27072f79c27c4987fc9d2ed2bd56",
"md5": "df62bd4aed412602a115cc27da506bc7",
"sha256": "aeb19549eacc9b93bb8f43865544e887c9bf58d976a72174e06217f0814250bc"
},
"downloads": -1,
"filename": "windows_filepath-0.10.tar.gz",
"has_sig": false,
"md5_digest": "df62bd4aed412602a115cc27da506bc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4471,
"upload_time": "2023-01-03T02:37:42",
"upload_time_iso_8601": "2023-01-03T02:37:42.585697Z",
"url": "https://files.pythonhosted.org/packages/8e/00/09abfe7bc94963c842a39cb098f95daa27072f79c27c4987fc9d2ed2bd56/windows_filepath-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-03 02:37:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "windows_filepath",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "windows-filepath"
}