I have a NodeJS project that I'm having call a Python script which simply makes a new directory in a remote file storing network (a UNC path).
However, when I try to use os.mkdir
in the Python, it seems that on the server-side, the Node doesn't want to escape the '\' characters, meaning it's trying to create a directory "\\\\myserver.com\\folder1\\newFolder"
instead of "\\myserver.com\folder1\newFolder"
Code:
NodeJS:
var pyshell = new PythonShell('mkdir.py', {scriptPath:"/path/toScript"}); //Calls python script (works well)
Python:
import os
import sys
print("SCRIPT CALLED") #Test that .py file is being called
os.mkdir("\\\\myserver.com\\folder1\\newFolder")
Output (on server):
SCRIPT CALLED #Shows script is being called properly, as print method is showing
Error: OSError: [Errno 71] Protocol error: '\\\\myserver.com\\folder1\\newFolder'
File "/home/mkdir.py", line 8, in <module>
os.mkdir("\\\\myserver.com\\folder1\\newFolder")
My best guess here based on the error is that it's not escaping the characters when trying to make the directory. Any insight? I'd really appreciate any help.