os.access(file, os.R_OK) on UNIX and WINDOWS
Hello, on UNIX I changed the permission of a file "myfile" with chmod 000 myfile. Then I got 0 from os.access(myfile, os.R_OK). This is ok. Then I checked the same file on WINDOWS (with samba): I got "True" from os.access(myfile, os.R_OK). I think it is not ok?! In my python script I check the return value of os.access(myfile, os.R_OK) and when it is "True" I copy the file with shutil.copy(myfile, newfile). But on WINDOWS I get the error: IOError: [Errno 13] Permission denied. How can I check the right file access with python on WINDOWS before copying the file? Is it a samba configuration? Thank' for your hints, Kai -- http://mail.python.org/mailman/listinfo/python-list
Windows: get owner and group of a file
Hello, with ls -l on windows I get -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile How can I get on windows with a standard python 2.2 (without windows extensions) the information "500" and "everyone" (owner and group)? Also I cannot use popen('ls -l'). With import stat stat_info = os.lstat(myfile) owner = "%-8s" % stat_info.st_uid group = "%-8s" % stat_info.st_gid I get 0 for owner and group. Thanks for your hints, Kai -- http://mail.python.org/mailman/listinfo/python-list
determine 32 or 64 bit architecture with python 2.2
Hello, how can I determine the architecture (32 or 64bit) with python 2.2 on Windows or Unix (AIX, Solaris) OS, without the modul platform? Thanks for your hints, Kai -- http://mail.python.org/mailman/listinfo/python-list
com: makepy gencache.EnsureModule
Hello, I' having a problem with gencache.EnsureModule: I used win32com\client\makepy.py to successfully generate Python sources. Unfortunately, after I call win32com.client.Dispatch(), the object I get back is of type "COMObject" instead of one of the generated classes. In particular, I'm trying to interact with SolidWorks Extensibility Type Library and the PROGID is "SldWorks.Application". Using win32com\client\makepy.py -i SolidWorks Extensibility Type Library {801A-A66C-11D3-A8BD-861EBBD6}, lcid=0, major=1, minor=0 >>> # Use these commands in Python code to auto generate .py support >>> from win32com.client import gencache >>> gencache.EnsureModule('{801A-A66C-11D3-A8BD-861EBBD6}', 0, 1, 0) Looking in win32com\gen-py, the appropriate file _does_ exist: 801A-A66C-11D3-A8BD-861EBBD6x0x1x0.py and it does contain the correct class definitions. Then, in my code: >>> mod = >>> win32com.client.gencache.EnsureModule('{801A2001-A66C-11D3-A8BD-861EBBD6}', >>> 0, 1, 0) >>> mod None >>> ob = win32com.client.Dispatch("SldWorks.Application") >>> ob Why are the object mod is None and the object ob is instead >? Any bright ideas as to what's going wrong here? Thanks for your hints, Kai -- http://mail.python.org/mailman/listinfo/python-list
resolve environment variables in string - regular expression
Hello, how can I resolve envionment variables in a string. e.g. strVar = /myVar resolve in str1 = /mytest02/$MYVAR/mytest02 --> /mytest02//myVar/mytest02 (unix) str2 =$MYVAR/mytest03 --> /myVar/mytest03 (unix) str3 =%MYVAR%/mytest03 --> /myVar/mytest03 (windows) I would not set the variables in this time. I think I need a little regular expression code snippet, but I have not work with regular expression before. Thanks for your help, Kai. -- http://mail.python.org/mailman/listinfo/python-list