![]() ![]() never protect your statements with try:/except:, that's counter-productive. It's a simple mistake that you could have seen if it hadn't for the stupid exception catch which mislead you.īut with the generic try/except block without any argument, you just get mount failed useless message. Returns an integer, so if you remove the exception block you get error because you're adding a string with an integer ( TypeError: Can't convert 'int' object to str implicitly). In your case, the problem is the general exception block. Copy log file from linux to windows code#Second, you really don't need Popen, but call (and as a bonus you get the return code directly) rc = subprocess.call(["mount","-t","cifs", "-o", "username="+username+",password="+password,įirst, drop the exception block as it hides error details, anyway Popen and other subprocess methods only throw exceptions when they cannot start commands (because of command not found), which means that mount is actually called. ![]() Subprocess.Popen()ĭef mountShare(hostname, username, password): I'm happy to try using something else but would love to know what's wrong here. I had something like this but it doesn't work, creates the necessary temporary directories but never mounts anything. Ideally I would use this method to mount the remote windows c$ share and then copy the files but I'm willing to try other modules if they make more sense. Unfortunately I get errors about the password attributed being invalid when I run that command in bash. Mount -t cifs -o username=someUsername,password=somePasword //someMachine/someShare /someMountPoint I had hoped to simply use something like this: ![]() The server would be using an active directory role acount for the copy credential. One of the first steps of the cgi is that it needs to copy files from the linux webserver to windows machines. I'm building a website which has a form which captures user data and runs some cgi on the user data. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |