Skip to content

Commit d91fa72

Browse files
committed
Remove double or single quotes from printed path
1 parent 62a0797 commit d91fa72

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

nbs/01_config.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,14 @@
425425
"source": [
426426
"#| export\n",
427427
"def set_pystata_path(stata_dir=None):\n",
428+
" stata_dir = stata_dir.strip('\"')\n",
429+
" stata_dir = stata_dir.replace(\"'\", \"\")\n",
428430
" if stata_dir is None:\n",
429431
" stata_dir, _ = find_dir_edition()\n",
430432
" if not os.path.isdir(stata_dir):\n",
431-
" raise OSError(f'Specified stata_dir, \"{stata_dir}\", is not a valid directory path')\n",
433+
" raise OSError(f'Specified stata_dir, {stata_dir}, is not a valid directory path')\n",
432434
" if not os.path.isdir(os.path.join(stata_dir, 'utilities')):\n",
433-
" raise OSError(f'Specified stata_dir, \"{stata_dir}\", is not Stata\\'s installation path')\n",
435+
" raise OSError(f'Specified stata_dir, {stata_dir}, is not Stata\\'s installation path')\n",
434436
" sys.path.append(os.path.join(stata_dir, 'utilities'))"
435437
]
436438
},

nbstata/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ def find_edition(stata_dir):
113113

114114
# %% ../nbs/01_config.ipynb 25
115115
def set_pystata_path(stata_dir=None):
116+
stata_dir = stata_dir.strip('"')
117+
stata_dir = stata_dir.replace("'", "")
116118
if stata_dir is None:
117119
stata_dir, _ = find_dir_edition()
118120
if not os.path.isdir(stata_dir):
119-
raise OSError(f'Specified stata_dir, "{stata_dir}", is not a valid directory path')
121+
raise OSError(f'Specified stata_dir, {stata_dir}, is not a valid directory path')
120122
if not os.path.isdir(os.path.join(stata_dir, 'utilities')):
121-
raise OSError(f'Specified stata_dir, "{stata_dir}", is not Stata\'s installation path')
123+
raise OSError(f'Specified stata_dir, {stata_dir}, is not Stata\'s installation path')
122124
sys.path.append(os.path.join(stata_dir, 'utilities'))
123125

124126
# %% ../nbs/01_config.ipynb 29

0 commit comments

Comments
 (0)