Permissions problems


  1. Posts : 3
    Windows 10 Linux Mint 17.3
       #1

    Permissions problems


    Hi all,
    I have been a long time linux user and now I am really confused by permissions in Windows 10.
    I created a python script in linux which works fine and am now trying to get it to work in Windows.
    In C:\ProgramData there is a subdirectory into which I can paste files I have copied from a flash drive using File Explorer.
    I am the only user on this machine and am administrator.
    If I run the python script it seems to work without errors but the file never gets pasted.
    Even if i run the script from Command Prompt (Admin) it fails with no error messages.
    How does this all work and can I get it to work?

    Code:
    #!c:/Python27/pythonfrom Tkinter import *
    import tkFileDialog
    import tkMessageBox
    import os
    import time
    from ctypes import windll, byref, wintypes
    from ctypes.wintypes import SMALL_RECT
    
    
    
    
    root = Tk()
    STDOUT = -12
    
    
    todir = "c:/ProgramData/SoundBox/Videos"
    #Pick a video file and copy it.
    def select_video():
        myname=tkFileDialog.askopenfilename(initialdir="C:/")
        if myname =="":
               return()
        else:
                (filepath, filename) = os.path.split(myname)
                myfin = filename
                print myfin
                doit="copy "  + myname + " " + todir
                print doit
                quit()
    hdl = windll.kernel32.GetStdHandle(STDOUT)
    rect = wintypes.SMALL_RECT(0, 50, 50, 30) # (left, top, right, bottom)
    windll.kernel32.SetConsoleWindowInfo(hdl, True, byref(rect))
    select_video()
    
    
    root.mainloop()
    I intend to end up with this as a gui program but am stuck at present
    tia.
      My Computer


  2. Posts : 3
    Windows 10 Linux Mint 17.3
    Thread Starter
       #2

    Re: permissions problems


    Just an update.
    Here's what does work.
    Code:
    #!c:/python27/pythonw
    from Tkinter import *
    import tkFileDialog
    import tkMessageBox
    import os
    root = Tk()
    D = StringVar()
    D.set("")
    lab1 = Label(root, textvariable=D)
    lab1.pack()
    to_file="c:/programData/SoundBox/Videos/"
    def select_video():
        global to_file
        inname=tkFileDialog.askopenfilename(initialdir="c:/")
        if inname =="":
               D.set("No File Chosen")
               return()
        else:
                D.set("Copying File, Please wait")
                (filepath, filename) = os.path.split(inname)
                inmessage = "inname is " + inname
                in_file = open(inname, 'rb')
                print inmessage
                indata = in_file.read()
                to_file +=filename
                print to_file
                out_file = open(to_file, 'wb')
                out_file.write(indata)
                quit()
    
    
    select_video()
    print "Alright, all done."
    
    
    root.mainloop()
    Don't ask me why there should be a difference
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:19.
Find Us




Windows 10 Forums