C# FileSystemWatcher & StreamReader gives "File is being used by another process" error - streamreader

I have codes to watch a folder and open to read new files. When new file(s) fall into folder program works and do what it should do. Problem is related with other next file(s). If another file(s) fall into folder, program is giving "File is being used by another process" error message. I already read every similar questions in Stackoverflow and in Google. But non of them solved my problem. I don't think that problem is with my codes since when I assign same codes to a button and click manually after file falls to folder, program is working properly. But when FileSystemWatcher runs those codes it gives error at second time. Is there anyone who can advise a solution ?

I couldn't find the reason of the problem but I found my own solution.
I gave-up using FileSystemWatcher, instead I created a timer for 1 minute and at the end I check file quantity in the folder. If there is any change, I run the main codes. Now my problem has been fixed.

Related

Merge schemas of custom dialog - Error conflicting definitions

I am following the steps of this page:
https://learn.microsoft.com/en-us/composer/how-to-create-custom-actions
and have reached to the part where it is required to merge the two schemas: bots and your custom one. However when running the powershell script found inside the created project template (CoreAssistant template) I have the following error:
Error conflicting definitions of HelpDialog.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\HelpDialog.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\HelpDialog.dialog
Error conflicting definitions of HelpDialog.en-us.lu.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Error conflicting definitions of HelpDialog.lu.dialog
HelpDialog is a predefined dialog that was already present. I have installed NodeJs and #botframework-cli package because it was required from the powershell script in order to run bf dialog:merge and now it seems these two sources have some kind of conflict.
To add to other answers, changes that worked for me are as follows:
update-schema.ps1, line 11, change "!**/generated" to "!../generated" and add "!../dialogs/imported"
Also, make sure that your custom action project is INSIDE of your bot directory, it should be a folder next to the "schemas" folder for the script to find it.
Note/Edit: Having the project nested inside the bot works to get the script working, though I do not recommend it due to causing other errors. Oddly, I found it was best to move the whole custom solution up a level, next to the bot project. You may have to edit the [botName].sln file in notepad to reference the location of the project, as well as editing the bot project's project reference.
I fixed it by changing the script. I noticed the script was trying to ignore the folder imported and generated but the error message indicated it was not doing so. So I changed it from !**/generated to !../generated.
I experienced the same issue.
To fix this problem you could simply delete the corresponding dialogs in the "imported" folder. Note that this will, however, delete these dialogs in your bot, which is not optimal but should be of little concern for a sample application.

Blueprism Issue with Finding File

I have a process which zips a file and emails it on. The process works most of the time. However, every so often I get an error message similar to the below.
ERROR: System Exception : Could not execute code stage because exception thrown by code stage: Could not find a part of the path 'T:\Path\Folder\File.zip'.
This is strange as it is able to find the original excel file, then zip it.
If I use the location from the error message I am able to find the file.
Is there an issue with the time it takes for the machine to find the file? Is this a bug?
It may happen that the file is getting zipped and you are trying to pick it up for sending mail, So solution Can be
Give some wait of 1 or 2 sec after zipping (as it may require some time for finishing work Not sure.)
While sending mail please ensure the file exists at location
If Point 2 is true, send the email with attachment
If point 2 is false, Raise the error to main process: "Zipped file not found"
After the zipping the files, if not created/zipped retry for 3 time or you can raise the error "Error: while zipping the files".
Ensure that zip file name should not contain any special character like ` , :
By doing so, we can able to find where the exact error is, whether is is on zipping code or file existence.

UITestActionLog is empty after long running codedui tests

Does anyone know anything about the UITestActionLog.html file ending up empty for long running test.
When I run just a few steps I get the file just fine with the expected content.
When I run my full test a bit over two hours the file ends up with just 28kb but with virtually no content. It just has this in it "Coded UI Test Log" on the top-left and "TOTAL TIME:" on the top-right.
I could not find anything about it on the web.
I am wondering if someone else has had this issue and what could be tweaked to make it work.
Thanks
This is happening because the images captured are too large when you have:
Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
We changed that parameter to:
Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.ErrorAndWarningOnlySnapshot;
We don't have screenshots anymore but we have the details of the steps (i.e. the HTMl file is still generated)!
Next I will looks at the System.Drawing to see if we can't override the default screenshot size and encoding, this way we can restore the AllActionSnapshot but with lower resolution of screenshots....to be continued!

FTP.retrbinary fails

I'm a complete Python novice, so I apologize if the solution to my problem seems obvious. I'm having difficulty with some relatively simple code that I've written. I've scanned several related questions that have already been posted, but I don't see where my code differs in any meaningful way from the solutions suggested.
I'm trying to write a program that will:
Establish a ftp connection to a remote server.
Change the working directory on the ftp server.
Retrieve a list of files in the working directory from the ftp server.
Find a file ending with a specific suffix from the retrieved list of files.
Retrieve the found file to a temporary directory (created by tempfile.mkdtemp()) on the user's local file system.
Steps 1 through 4 are working as expected. Sadly, the last step is falling into my except clause.
Can anyone make a suggestion regarding what might be wrong with the following line of code?
ftp.retrbinary('RETR ' + file, open(opsys.path.join(localTempDir, fileName)).write)
Your suggestions are greatly appreciated. Thanks, in advance.
Possible problems:
- type(file) = incorrect value
- opsys.path.join(localTempDir, fileName) = incorrect value #nonexistent file
Thats all what comes to mind looking on presented line of code =)

Problems came up in the following areas during load: Table

I have generated an excel file from xml. But i can not open it with Excel. Excel gives the following error opening it:
Problems came up in the following areas during load:
Table
Then it shows a message that the log file corresponding the error can be found at : C:/Documents and Setting/myUserName/Local Settings/Temporary Internet Files/Content.MSO/xxxxx.log
But i can not find Content.MSO folder in my windows. I checked folder settings and made all folders visible but i still can not access this folder. So that i can not analise the log file.
how could i find the generated log file?
I found the problem without analising the log file. i stil can not access the log file in temporary internet files. But i realised that i put a string(non-number) characters on a number-styled cell in Excel xml. So if you having the similar issues about your Excel file generated from xml, then have a look at if your cell values are appopriate with your cell data type.
If you type or paste the path of the log file into Explorer or your text editor of choice, you may find that the folder does exist, despite being invisible.
In my case it was a <Row> with an incorrect ss:Index
I was using a template and the last row had a fixed Index=100. If the number of rows I added exceeded 100, this last row had a wrong index and excel threw the error without any other message or log (MacOSX, Excel 15.25.1). I wish they printed more informative error messages, what a waste of our time.
Excel 2016. My error message was "Worksheet Settings". Path was pointing to non-existing file.
My cause of the problem was ExpandedRowCount not big enough for number of rows in Worksheet. If you add rows in XML directly (i.e. on a machine where Excel is not installed), make sure to increment number of rows in ExpandedRowCount.
yes.Even i too faced the same problem and problem was with the data type of cells ofexcel generated using xslt
In addition to checking the data being used vs "Type" assigned, make sure that the list of characters that need to be encoded for XML are indeed encoded.
I had a system that appeared to be working, but then some user data including & and < was throwing this error.
If you're not sure what's going on with your file, try http://www.xmlvalidation.com/ - that helped be spot the issue in a large file immediately.
I used this function to fix it, modified from this post:
function xmlsafe($s) {
return str_replace(array('&','>','<','"'), array('&','>','<','"'), $s);
}
and then run echo xmlsafe($myvalue) where you were just echoing $myvalue in your script.
This seems to be more appropriate for XML than htmlentities() or other options built into PHP.
I had the same issue, and the answer was - type of Cell was Number and some values doesn't converts to this type on my backend.
I had the SAME problem,
and its because de file is TOO BIG.
I try an extract from SAP, more little than the one with that make the error) and save it in XML file. and it WORK, no more error.
so maybe if you can save in 2 Excel files XML instead of 1 it will be good ;)
ALicia

Resources