Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

設定檔位置 #36

Closed
dicib opened this issue Mar 8, 2017 · 6 comments
Closed

設定檔位置 #36

dicib opened this issue Mar 8, 2017 · 6 comments

Comments

@dicib
Copy link

dicib commented Mar 8, 2017

說明頁提到 "設定檔位於 %USERPROFILE%\comiccrawler\setting.ini"
請問可以修改設定檔位置嗎?

@eight04
Copy link
Owner

eight04 commented Mar 8, 2017

目前沒有。所有的路徑包括設定檔、存檔、log,都是寫死在程式內的。
https://github.com/eight04/ComicCrawler/blob/master/comiccrawler/config.py#L50

修改設定檔位置的用途是?

@dicib
Copy link
Author

dicib commented Mar 8, 2017

使用 WinPython 放在隨身碟帶著走
也偏好把設定檔放在執行檔同目錄下,保持 %USERPROFILE% 儘量淨空

@eight04
Copy link
Owner

eight04 commented Mar 8, 2017

加上一個 --profile 參數如何?類似︰

G:\> "WinPython\python\scripts\comiccrawler" --profile ".\comiccrawler" gui

-> the setting and saves now go to "G:\comiccrawler"

我剛下載了 WinPython 的 Zero 版本,但 Control Panel 無法啟動;Command Prompt 中使用 pip 則是會讀取到原系統上的 packages。不太確定它是怎麼運作的。

@dicib
Copy link
Author

dicib commented Mar 8, 2017

提供選擇性設置 --profile 這樣設計相當明瞭!

感謝特地下載做測試... 據所知 Control Panel 是基於 PyQt,而 zero 版本沒有包含 Qt,須另外安裝。winpython/winpython#397 (comment)

Command Prompt 下 pip 指令會讀到原系統,應該是環境變數 PATH 所致;如果使用絕對路徑指向 WinPython 底下的 python.exe 應該就不會讀取原系統了。

在安裝 comiccrawler 後,WinPython 目錄底下的 settings 資料夾裡面也會出現 comiccrawler 資料夾和 setting.ini,可是不知道怎麼讓 WinPython 環境下運作的 comiccrawler 去讀寫它,而不要讀寫 %USERPROFILE%...

我對 WinPython 也不熟,使用 WinPython 除了著眼於可攜,以及切換使用 Python 2 方便,要測試 package 也不用反安裝,可以設後不理 XD

@eight04
Copy link
Owner

eight04 commented Mar 8, 2017

我發現 WinPython 的 command prompt 會把環境變數 HOME 設為 WinPython\settings。也就是說,從 WinPython command prompt 中執行的 python 程式在展開「~」時都會被導向它的 settings 資料夾。你提到的 WinPython\settings\comiccrawler 就是這樣產生的。

至於為何我在 WinPython 內能讀到原系統上的 packages,是因為我把 packages 都裝到 USER_SITE 內(pip install xxx --user),而 WinPython prompt 並沒有設定這部份的環境變數。只要將 PYTHONUSERBASE 覆寫成 WinPython\settings 就不會看見原系統內的 package 了。

不過即使可以透過設定 HOME 來改變設定檔位置,能在 CLI 直接指定 profile 資料夾也是很好的。我還是打算實作這個功能。

@eight04
Copy link
Owner

eight04 commented Mar 9, 2017

已於 2017.3.9 修正

@eight04 eight04 closed this as completed Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants