posix

Bash check if file was modified within date range

Bash check if file was modified within date range Question: I have a script that checks to see if a cert, (.cer file), is within 14 days of expiring, and if it is, it will archive the old cert request, generate a new one, and send it to the middleware team. The thought occurs though, …

Total answers: 1

Twisted application ignoring a certain UNIX signal – is it possible?

Twisted application ignoring a certain UNIX signal – is it possible? Question: Let’s say we have the following situation: kill <pid> sends SIGTERM kill -<SIGNAL> <pid> sends <SIGNAL> Sometimes, during development, I need to kill my application and restart it, at the moment – using the first type of command. But, if I have a …

Total answers: 2

Does the Python regular expression module use BRE or ERE?

Does the Python regular expression module use BRE or ERE? Question: It appears that POSIX splits regular expression implementations into two kinds: Basic Regular Expressions (BRE) and Extended Regular Expressions (ERE). Python re module reference does not seem to specify. Asked By: tarabyte || Source Answers: Except for some similarity in the syntax, re module …

Total answers: 2

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()?

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()? Question: I am using a scientific software including a Python script that is calling os.system() which is used to run another scientific program. While the subprocess is running, Python at some point prints the following: close failed in file object destructor: IOError: [Errno …

Total answers: 3

Is there anyway to modify stat information like mtime or ctime manually in Python or any language at all?

Is there anyway to modify stat information like mtime or ctime manually in Python or any language at all? Question: I am trying the following code: os.stat(path_name)[stat.ST_CTIME] = ctime However, this gives the following error: exceptions.TypeError: ‘posix.stat_result’ object does not support item assignment Is there anyway to modify ctime? Thanks! Asked By: Dagvadorj || Source …

Total answers: 4

Expanding Environment variable in string using python

Expanding Environment variable in string using python Question: I have a string containing an environment variable, e.g. my_path = ‘$HOME/dir/dir2’ I want parse the string, looking up the variable and replacing it in the string: print "HOME =",os.environ[‘HOME’] my_expanded_path = parse_string(my_path) print "PATH =", my_expanded_path So I should see the output: HOME = /home/user1 PATH …

Total answers: 3

Does Python zipfile always use posixpath filenames regardless of operating system?

Does Python zipfile always use posixpath filenames regardless of operating system? Question: It probably won’t matter for my current utility, but just for good coding practice, I’d like to know if files in a ZIP file, using the zipfile module, can be accessed using a POSIX-style pathname such as subdir/file.ext regardless of on which operating …

Total answers: 2