I have a fairly simple little python program to automate starting an editor on a wiki page. It works fine on the system where I wrote it (xubuntu 16.04, python 3 version 3.5.2) but it comes up with the following error on a newer system (xubuntu 17.10, python 3 version 3.6.3).
Here is the error:- chris$ no Traceback (most recent call last): File "/home/chris/bin/no", line 59, in <module> os.execvp("vi", ("", monthFile,)) File "/usr/lib/python3.6/os.py", line 559, in execvp _execvpe(file, args) File "/usr/lib/python3.6/os.py", line 594, in _execvpe exec_func(fullname, *argrest) ValueError: execv() arg 2 first element cannot be empty Has execvp() become stricter in 3.6.3 or what? ... and here is the program:- #!/usr/bin/python3 # # # Create Dokuwiki journal month pages # import sys import os import time import calendar jdir = "/home/chris/wiki/data/pages/journal" # # # Default month and year is 'now' # month = time.localtime().tm_mon year = time.localtime().tm_year # # # If one parameter is given then it's the month # if len(sys.argv) == 2: month = int(sys.argv[1]) # # # If two parameters are given they are month and year # if len(sys.argv) == 3: year = int(sys.argv[2]) month = int(sys.argv[1]) # # # # # # # Check if the year directory exists and create it if it doesn't # yearDir = os.path.join(jdir, str(year)) if not os.path.exists(yearDir): os.mkdir(yearDir) # # # Check if month file exists, create it if it doesn't and write heading and links # if month < 10: monthFile = os.path.join(yearDir, '0' + str(month) + '.txt') else: monthFile = os.path.join(yearDir, str(month) + '.txt') if not os.path.exists(monthFile): monthName = calendar.month_name[month] f = open(monthFile, 'w') f.write(monthName + " " + str(year) + "\n") for i in range(len(monthName) + 5): f.write("=") f.write("\n") f.close() os.execvp("vi", ("", monthFile,)) -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list