Cannot acquire connection to Excel - excel

I have a package with a ForEach Loop Container that is looping through Excel files in directory. Everything is fine until I add #User::Excel to the expressions box in the ExcelFile Path connection manager properties. Then I always get this error:
...DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER......failed with error code 0xC02020096...
I have been dealing with this all day yesterday and this error is killing my deadline. I have everything setup just like any other package I have run with ForLoop and Excel. Why is this time giving me so many problems?
May someone please guide me through some troubleshooting? I have tried everything I know.

Apparantly the package didn't like my ForEach Loop container in a Sequence Container...took the loop out of the Sequence Container, reconfigured, put back in the Sequence Container and worked fine.

Related

Golem Task respons back with runtime error 2, can't determine the cause

Repo for all code I've been using is updated here . When I run the requestor script it exits with a runtime error 2 (File not found). I am not sure how to further debug this or fix it. So far I've converted my code over to a python slim docker image to better mirror the example. It also works for me when I spin up a docker image that typing and running "/golem/work/imageclassifier.py --trainmodel" works from root. I switched all my code to use absolute paths. I also did make sure the shebang (#!) uses linux end of file characters rather than windows before which was giving me errors. Fixed a bug where my script returns error code 2 when called with no args to now pass.
clf.fit(trainDataGlobal, trainLabelsGlobal)
pkl_file = "classifier.pkl"
with open(pkl_file, 'wb') as file:
pickle.dump(clf, file)
is the only piece I could think of that causes the issue, but as far as I can tell this is the proper way to pickle something in python. Requestor script is also heavily based on the simple service example and I tried to mirror my design to that. I just need help in getting more information while debugging, or guidance on how to move forward from here

Python 3.7: Pygsheets get all record stopped working

I have several scripts using pygsheets to get information from google sheets. Today they have stopped working without any errors or exceptions being noted.
Debuging Attempts:
Tried running in different ways
1. Visual Studio Code - just stops working no errors or exceptions. Debugged to line (wks = sh.worksheet('title', tabs))
2. command prompt - pops a window up that states "Python has stopped working: A problem caused the program to stop working correctly. Please close the program"
3. manually in IDLE - locks up at (wks = sh.worksheet('title', tabs))
4. Ran code on a different machine: worked fine.
So, I know it has to do with something on my machine, but not sure where to start looking. Any suggestions are welcome.
import pygsheets
from pygsheets import Worksheet
gsheet = pygsheets.authorize(service_file = 'client_secret2.json')
sh = gsheet.open('Google_file_name')
wks = sh.worksheet('title', 'tab_name')
results = wks.get_all_records()
The last line is where everything stops. Again, no errors or exceptions.
I know this doesn't really solve the issue, nor do I have experience with pygsheets, but from my experience with gspread the issue appears to be connection-related. I have had this exact issue with gspread's get_all_values module and, as you experienced, it suddenly stops working without any changes to the code and without terminating or returning any errors. The issue often disappears when the program is run again minutes or days later.
The only other time I have experienced freezing/hanging (recently in Python) is with TCP connections...

SQL CE 4.0 Error - ReleaseHandleFailed was detected

I keep getting this error in the dev environment - 'A SafeHandle or CriticalHandle of type 'System.Data.SqlServerCe.HasSafeHandle' failed to properly release the handle with value ...."
It is in a VS 2012 Winforms application and only seems to happen if a particular piece of code is run at some point. The error shows after the form is closed, but I can't understand why. It only happens in the dev environment and seems to be OK in the compiled version, but I don't want to just ignore it.
The error seems to be caused by this line of code, although weirdly at this point in time I have not opened a connection to the SQL ce database and the directory it is searching in does not have the SQL ce database in it. It is mearly reading in txt files that match a pattern
string[] fileNames = Directory.GetFiles(importDirectory, "BucketHistory*.txt")
I'll do some more digging tomorrow, it's late now, and I have no idea what is causing it.
Any pointers ??!
Turns out I was having a bit of brain fade yesterday. Been working too long hours !
For anyone interested, the problem was that I was opening a connection, then copying the file and running a shrink whilst the connection was still open. It had nothing to do with that line of code.
I would have expected the copy to have thrown an exception, but it didn't appear to. Oh, and opening another connection inside the using statement of the first one. Sigh.

Compile error when running on another machine

I am having a problem with a workbook. It works fine on my machine but when it is run by someone else it is giving a problem with an error message "Compile error can't find project or library"- thing is, it is doing it on a Mid$ string command!
Anyone know what could cause this? Is there a setting they need somewhere? The code was written in Excel 2010 and they are running Excel 2010
This is caused when you have a missing reference. Have a look in Tools > References on the machines that are throwing the error. You should see that certain references are prefixed with MISSING.
These libraries will need to be installed on the other machines in order to use them, alternatively, you could try late binding if they have an earlier version of the reference you are using.
If the above doesn't work, I have experienced this problem when there is a failed installation on the machine. None of the references are missing, but upon opening Excel a (usually unrelated) application gets stuck in a failed install loop. If this is what is happening, you'll need to rectify the failed installation.

Scriptom (groovy) leaves Excel process running - am I doing something wrong?

I am using the Scriptom extension to Groovy 1.7.0 to automate some processing using Excel 2007 under Windows XP.
This always seems to leave an Excel process running despite my calling quit on the excel activeX object. (There is a passing reference to this phenomenon in the Scriptom example documentation too.)
Code looks like:
import org.codehaus.groovy.scriptom.ActiveXObject;
def xls = new ActiveXObject("Excel.Application")
xls.Visible = true
// do xls stuff
xls.Quit()
The visible excel window does disappear but an EXCEL process is left in the task manager (and more processes pile up with each run of the script).
There are no error message or exceptions.
Can anyone explain why the Excel process is left behind and is there any way to prevent it from happening?
This works:
xls.Quit()
Scriptom.releaseApartment()
The javadocs state:
In some cases, the JVM can close
before everything is cleaned up, which
can leave automation servers
(especially Excel) hanging. Call this
before your script exits to get
correct behavior from automation
servers.
Looks like you are missing
xls.release();
like it is done here.

Resources