twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
1.14k stars 67 forks source link

Possible accent error in Python run #246

Closed LucasLauri closed 1 year ago

LucasLauri commented 1 year ago

Hello, I'm trying to run a simple code to run through some files in a specific folder with this code:

import os
import pathlib  

print("---START---")

folderPath = "G:\\Meu Drive\\Obsidian Vaults\\Lauri's Vault\\600 Calendário\\Test"
print(folderPath)

for path, subdirs, files in os.walk(folderPath):
    for name in files:
        print(pathlib.PurePath(path, name))

print("---END---")

If I run this with this Obsidian plugin it seems me that no file is returned: image

But if i run it in Visual Code it runs normally: image

Another thing, if I run the same code with folderPath = "G:\\Meu Drive\\Obsidian Vaults\\Lauri's Vault" it woks OK in obsidian, maybe there is something with the accent in "600 Calendário"?

My plugins settings is: image

And my OS is Windows 10 if it helps.

hvitis commented 1 year ago

@LucasLauri

Try changing the Notebook mode. If not, then try running python in terminal:

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'

And update your Python path.

LucasLauri commented 1 year ago

@hvitis Disabling the Notebook mode and then close and open Obsidian worked!

Thanks :)