P4Python Adding new file - [Error]: Null directory (//) not allowed in //workspaceXXXX//xxxx.txt - python-2.7

I am trying to add new to perforce. I getting error as below
[Error]: "Null directory (//) not allowed in '//workspaceXXXX//xxxx.txt'."
What i am doing:
1) I create a workspace
self.p4.client = "workspaceXXXX"
client = self.p4.fetch_client("workspaceXXXX")
client._root = "../temp/"workspaceXXXX""
depotPath = "//TEAM/PATH_1/PATH_2/2018-Aug-06/..."
wsPath = "//workspaceXXXX/..."
client._view = [depotPath+" "+wsPath]
"""Create a workspace"""
self.p4.save_client(client)
2) Place the new in the workspace
3) Add file
self.p4.run("add", "//TEAM/PATH_1/PATH_2/2018-Aug-06/xxxx.txt")
While adding file i encounter the above error. What am i doing wrong here.

Related

Django log create new log file after file size reach 1050KB

I decide to create a log file and this log file i wish to have a maximun size limit (1050kb). If the log(testlog.log) size is full, i wish to create a new log file which is (testlog_1.log). I try below code but the file doest not create when it come to 1050KB.
log_format = "%(asctime)s::%(levelname)s::%(name)s::"\
"%(filename)s::%(lineno)d::%(message)s"
today = date.today()
# dd/mm/YY
d1 = today.strftime("%d%m%Y")
filenameDate=d1
filenameDate=str(filenameDate)
logpath="D:\\Pin\\"+filenameDate+".log"
logging.basicConfig(filename=logpath, level="DEBUG", format=log_format)
log = logging.getLogger()
handler = RotatingFileHandler(logpath, maxBytes=1 * 1024 * 1024, backupCount=100, mode="a", delay=False)
if (log.hasHandlers()):
log.handlers.clear()
log.addHandler(handler)
fmt = logging.Formatter(log_format)
handler.setFormatter(fmt)
I get below error:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\\Pin\\16022020test2.log' -> 'D:\\Pin\\16022020test2.log.1'
please help.

Liquidsoap Icecast request.dynamic error

I would like to create dynamic playlist with liquidesoap and icecast. I've just copied the tutorial from the liquidsoap website but unfortunately it does not work.
This is my code:
def get_next() =
result = list.hd(get_process_lines("/var/www/radiod/yii program-generator/next-track 1"))
# Create and return a request using this result
request.create(result)
end
# Create the source
s = request.dynamic(id="s", get_next)
# Output
source = output.icecast(%mp3, host="localhost", port=8000, mount="opera.mp3", password="asd123", s)
I get this error message when I run the check command:
Invalid value at line 9, char 20-37: That source is fallible.
So, the problem will be around this line:
s = request.dynamic(id="s", get_next)
Can you help me what could be the failure?
Thanking you in advance!
http://savonet.sourceforge.net/doc-svn/quick_start.html covers "That source is fallible." in detail. Might want to go through the whole page.

Django: No such file or directory

I have a process that scans a tape library and looks for media that has expired, so they can be removed and reused before sending the tapes to an offsite vault. (We have some 7 day policies that never make it offsite.) This process takes around 20 minutes to run, so I didn't want it to run on-demand when loading/refreshing the page. Rather, I set up a django-cron job (I know I could have done this in Linux cron, but wanted the project to be as self-contained as possible) to run the scan, and creates a file in /tmp. I've verified that this works -- the file exists in /tmp from this morning's execution. The problem I'm having is that now I want to display a list of those expired (scratch) media on my web page, but the script is saying that it can't find the file. When the file was created, I use the absolute filename "/tmp/scratch.2015-11-13.out" (for example), but here's the error I get in the browser:
IOError at /
[Errno 2] No such file or directory: '/tmp/corpscratch.2015-11-13.out'
My assumption is that this is a "web root" issue, but I just can't figure it out. I tried copying the file to the /static/ and /media/ directories configured in django, and even in the django root directory, and the project root directory, but nothing seems to work. When it says it cant' find /tmp/file, where is it really looking?
def sample():
""" Just testing """
today = datetime.date.today() #format 2015-11-31
inputfile = "/tmp/corpscratch.%s.out" % str(today)
with open(inputfile) as fh: # This is the line reporting the error
lines = [line.strip('\n') for line in fh]
print(lines)
The print statement was used for testing in the shell (which works, I might add), but the browser gives an error.
And the file does exist:
$ ls /tmp/corpscratch.2015-11-13.out
/tmp/corpscratch.2015-11-13.out
Thanks.
Edit: was mistaken, doesn't work in python shell either. Was thinking of a previous issue.
Use this instead:
today = datetime.datetime.today().date()
inputfile = "/tmp/corpscratch.%s.out" % str(today)
Or:
today = datetime.datetime.today().strftime('%Y-%m-%d')
inputfile = "/tmp/corpscratch.%s.out" % today # No need to use str()
See the difference:
>>> str(datetime.datetime.today().date())
'2015-11-13'
>>> str(datetime.datetime.today())
'2015-11-13 15:56:19.578569'
I ended up finding this elsewhere:
today = datetime.date.today() #format 2015-11-31
inputfilename = "tmp/corpscratch.%s.out" % str(today)
inputfile = os.path.join(settings.PROJECT_ROOT, inputfilename)
With settings.py containing the following:
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
Completely resolved my issues.

unable to run openstack tempest testcases in group

i have created one sampletest.txt file in tempest folder and written tempest test case location in that file.
now i want to run that file using testr or nosetest so that all the test case present in that file get executed..
example
contents in sampletest.txt file
tempest.api.identity.admin.test_users:UsersTestJSON.test_create_user_with_enabled
tempest.api.identity.admin.test_roles:RolesTestJSON.test_role_create_delete
tempest.api.identity.admin.test_roles:RolesTestJSON.test_get_role_by_id
tempest.api.identity.admin.test_roles:RolesTestJSON.test_remove_user_role
now i want to execute this sampletest.txt file so that all the testcase get executed...
if i am executing this file nosetests -vx sampletest.txt , i am getting error
Try to use tilt and cat the file Eg:
nosetest -vx `cat sampletest.txt`
Please make sure to configure your etc/tempest.conf are as below,
[identity]
uri=http://127.0.0.1:5000/v2.0/
uri_v3 = http://127.0.0.1:5000/v3/
auth_version=v2
admin_domain_name = Default
admin_tenant_name = admin
admin_password = {your_openstack_admin_login_password}
admin_username = admin
tenant_name = {non-admin-tenant-eg-demo}
username = {non-admin-user-eg-demo}
password = {non-admin-user-password}
[dashboard]
login_url=http://127.0.0.1/auth/login/
uri_v3 = http://127.0.0.1:5000/v3/
If still you are getting any errors please post your error logs.
You can also refer my post :http://naggappan.wordpress.com/2014/10/15/configure-and-execute-tempest-in-openstack-environment/

SVNSERVE access control, authz file

I have followed a tutorial and it works without the authz file, but when I add the file in in svnserve.conf
my root folder: /home/repos/
project 1 svnserve.conf:
anon-access = none
auth-access = write
password-db = /home/reops/passwd-users
authz-db = /home/repos/authz
if authz-db is commented out then it works but doesnt if its uncommented.
authz file:
[/project1]
nick = rw
harry = r
* =
when I checkout I get access denied for nick and harry even though its the right password for each user and they have access in authz file.
the error I get is authorization denied. Any ideas?
Found the answer:
the authz file was not formatted properly, it should have been:
[/]
[project2:/]
nick = rw
harry = r
* =