HydroSysPotsdam / Forester

Interactive and web-based visualization of decision trees.
GNU General Public License v3.0
4 stars 0 forks source link

python src/run.py returns error #48

Closed daniel-v-k closed 1 year ago

daniel-v-k commented 1 year ago

Describe the bug python src/run.py returns error

To Reproduce After pip installation, run "python src/run.py" in cmd (while in folder "Forester")

Expected behavior Run the program

Screenshots cmd content:

D:\git_repo\Forester>python src/run.py 18:08:54 | INFO | init : 50 | Created D:\git_repo\Forester\src\forester\instance 18:08:54 | INFO | init : 50 | Created D:\git_repo\Forester\src\forester\instance\temp 18:08:54 | INFO | init : 50 | Created D:\git_repo\Forester\src\forester\instance\data 18:08:54 | INFO | _validate_directory: 82 | Cleared the directory ./temp 18:08:54 | INFO | load_examples : 34 | Loading examples from D:\git_repo\Forester\examples Traceback (most recent call last): File "D:\git_repo\Forester\src\run.py", line 6, in from forester import server File "D:\git_repo\Forester\src\forester\server.py", line 6, in from .api import API File "D:\git_repo\Forester\src\forester\api.py", line 19, in database.load_examples(directory=os.path.join(PACKAGE_PATH, "../../examples")) File "D:\git_repo\Forester\src\forester\database\examples.py", line 52, in load_examples database.create_project_from_files(name, path, File "D:\git_repo\Forester\src\forester\database\projects.py", line 64, in create_project_from_files shutil.copy(path, project_path) File "C:\tools\Anaconda3\lib\shutil.py", line 427, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "C:\tools\Anaconda3\lib\shutil.py", line 244, in copyfile raise SameFileError("{!r} and {!r} are the same file".format(src, dst)) shutil.SameFileError: 'D:\git_repo\Forester\examples\Matlab Fanny\tree.json' and 'D:\git_repo\Forester\examples\Matlab Fanny\tree.json' are the same file

Please add the following information:

david-strahl commented 1 year ago

This error was due to faulty path splitting using the separator "/". On Windows it should be "\". I updated the code. Additionally, the server should still run even when (some) examples can not be loaded.

@daniel-v-k @lshydro Could you maybe confirm that the fix resolved the issue for you?

david-strahl commented 1 year ago

I tested Forester on multiple Windows machines and the fix (#52) seems to have resolved this specific issue.