I broke fossil-scm - SQLITE_NOTADB - fossil

In the Q&A style of stack exchange, I had this error and couldn't find a solution.
The accident was cause by me typing:
fossil update a_filename
This leads to corruption of the fossil-scm settings which outputs:
SQLITE_NOTADB: file is not a database
D:\bin\fossil.exe
SQLITE_NOTADB: file is not a database
D:\bin\fossil.exe: file is not a database
PRAGMA database_list
SQLITE_NOTADB: file is not a database
D:\bin\fossil.exe: file is not a database
PRAGMA database_list
SQLITE_NOTADB: file is not a database
D:\bin\fossil.exe: file is not a database
PRAGMASQLITE_NOTADB: file is not a database
^C^C
This runs forever.

The solution to this problem is to re-sync:
fossil sync https://<my_username>#<url>
which will prompt for password and deliver a status message that everything is okay.

Related

Win32Com Error Running with Task Manager

I have a python script that calls open an Excel file, calls a macro in the file, then closes. If I run the file from the CLI, it works. If i put it in Task Scheduler, I get an error from win32com.
Method opening the Excel file:
import win32com.client as WinCom
if os.path.exists(reportGeneratorFileName):
try:
xl = WinCom.Dispatch("Excel.Application")
xl.Workbooks.Open(Filename=os.path.abspath(reportGeneratorFileName))
xl.Application.Visible = False
xl.Application.Run("'{}'!Runner.Runner".format(reportGeneratorFileName))
l.info('Start Sleeping')
# Async mode of pythonw causes this to finish before the file is made
time.sleep(300)
l.info('Done Sleeping')
xl.Application.Quit()
except Exception as e:
l.error('Error updating file')
l.error(e, exc_info=True)
This is the Error i get:
06/04/2018 06:56:19 AM ERROR: (-2146959355, 'Server execution failed', None, None)
Traceback (most recent call last):
File "LAW Report.py", line 846, in createReport
xl = WinCom.Dispatch("Excel.Application")
File "c:\python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "c:\python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "c:\python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2146959355, 'Server execution failed', None, None)
Now i am running 64 bit python 2.7 and 64 bit win32com while office is 32 bit, but as I said above, if I just run the script from the CLI it runs fine, just not from task manager. I am running this on a Windows Server 2012R2. I have tried configuring the task for 2008, 2008r2, and 2012r2. I also tried with highest privileges. I do need this to be able to run whether user is logged on or not. Everytime I have tested, the user has been logged on.
You need to
1) setup permissions in DCOMCnfg utility for user under which you're running -or-
2) change user to your desktop user account.
But first you need to get proper error code, not a generic message.
Pay attention that this should be considered as temporary solution since DCOM is badly supported by MS for automation as service. Consider switching to any library as soon as possible. There're numerous problems with Excel interop: you will have to reboot server from time to time, performance degradation with subsequent calls, you can't run Excels in parallel because of a good chance of errors, etc...
I encountered the same error of which my program can run from command prompt but not from task scheduler.
I solved this issue with these settings of task properties in task scheduler:
1. General->Security Options
a. make sure same user account you used to run python/microsoft program.
b. checked "Run only when user is logged on.
c. unchecked "Hidden"
For 1a, I'm using DOMAIN\userid that I used to login my laptop/PC.
This is the only way I found in order for the task scheduler to run successfully. Hope this helps.

Create directory and write files to a remote, password protected computer

What I would like to do is be able to gain access to a computer over the network so I can create a new directory there that I will then save multiple files to throughout the rest of the script.
I have a script that creates a bunch of files that I need to save. The problem is that this script may be ran off any number of computers, but needs to save to the same computer. If I manually remote connect to the computer it prompts me for a username and password, but I am trying to just create a directory there. My code is below, along with the response I get.
if not os.path.exists(self.dirIn):
tryPath = self.dirIn.split("/")[0:-1]
tryPath = '/'.join(tryPath)
if not os.path.exists(tryPath):
os.mkdir(tryPath)
os.mkdir(str(self.dirIn))
else:
os.mkdir(str(self.dirIn))
WindowsError: [Error 1326] The user name or password is incorrect: '//computer/e$/directory/I/am/creating'
I am using Windows, Python27
I was able to just map the drive to my computer using subprocess, do what I needed, and then unmap the drive (optional)
subprocess.Popen("net use E: \\\\computername\\E$ %s /USER:%s" % (password, username))
time.sleep(1) # Short delay to allow E: drive to map before continuing
if not os.path.exists(self.dirIn):
os.makedirs(self.dirIn)
subprocess.Popen("net use E: /delete")
I did run into problems without the sleep, my program wouldn't find the directory without it.

informatica is taking the source file as the indirect file

I had made a source file data type change in source analyzer. I did realize that it had made the mapping invalid. I ran the mapping and it failed. Now I reverted the change, validated the mapping, check in the mapping, validated the workflow, check in the workflow.
Now I am getting the error:
Severity Timestamp Node Thread Message Code Message
INFO 7/23/2015 10:40:03 AM node01_CSADevelopment READER_1_4_1 FR_3055 Reading input filenames from the indirect file [<input_directory_folder>/<input_file>].
Severity Timestamp Node Thread Message Code Message
ERROR 7/23/2015 10:40:03 AM node01_CSADevelopment READER_1_4_1 FR_3000 Error opening file [<input_file_folder>/<header_of_the_input_file>]. Operating system error message [No such file or directory].
here the term "input file" is the file which I wanted to load and "header_of_the_input_file" is the header of the input file.
I don't understand, why it is happening. I had just made a small change and then reverted it.
The error is just saying the filenames mentioned in the indirect file are not found. So, you just need to make sure all the source files are there in the "input_file_folder"
There is a property in the session to configure the source file as indirect. An indirect file contains a list of source filenames. Informatica reads all the files listed and loads the data. If you think you have inadvertently made the source file indirect, you can change the option in session properties (mapping tab -> Source Qualifier)
It does not have anything to do with the datatype change and reverting it.

"Resource temporarily unavailable" error on reading CSV file in web2py app on PythonAnywhere

I have a python web2py app uploaded at PythonAnywhere. App is working fine. I want to read a csv file placed in a folder along with my app and import it into mysql table. When I try to read that CSV file, I get the error saying "[Errno 11] Resource temporarily unavailable".
I am new to python as well as PythonAnywhere and I couldn't understand this issue and can't figure it out how can I overcome this error and read a csv file successfully at server?
Note: I can run this code successfully on my local machine.
What I am doing is this:
path = '/home/user123/web2py/files/'
file_ = path+filename
print file_
with open(file_, "r") as f_obj:
reader = csv.reader(f_obj)
fields = reader.next()
print fields
self.create_new_table(tablename, fields)
Will appreciate any help in this regard.
Thanx in advance.
I opened server.log file in Web tab and found out that the print statement "print fields" was causing the error .... It tried to print all the column names and at the mid of those column names, it produced this error and stopped execution. I removed such print statements which were trying to print long statements and the error was gone!
It seems to be limit in print or something else similar to this, dont know exactly!

How to retry file transfer using transferId (IBM MQ fte)

We've been transferring files from one folder to another using CNTFTEAgent. But sometimes source file appears to be locked in a source folder (mq Explorer says that "file is not found" but it does exist though), so that transferring becomes as "failed".
We decided to use "exits" for retrying such failed tranfers.
The last fired "exit" is SourceTransferEndExit, but it does not contain information about file and filspace where file should be put to.
But it contains transferId. So my question is - how to retry transferring attemption using java API, or is it possible to do that somehow, if we know only transferId?
Such information can be found in TransferMetaInfo and looks like this -
com.ibm.wmqfte.TransferId => 414d5120434e54465445514d47522020ce34465321038a03
You can retry using ant, 'rcproperty' property hold transfer status. If transfer status is not '0' then retry.