It seems the file stream is not closed when it uses read command - karate

I use read command for some read files in the scenarios.
If the tests are running, the files can not be moved and deleted.
It seems that the file stream is not closed when it uses read command.
Can it close the files as declarative?
Environment:
Karate 0.9.2

We are also writing log files and in some cases this can cause issues, see: https://github.com/intuit/karate/issues/661#issuecomment-458127918
But I think keeping a file lock is expected. Also we are closing files whenever we read them, but maybe we have a bug. So if you can create a sample project to replicate your problem, that would be great: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Related

how to use separate karate-config-<env>.js files

I am trying to use separate karate-config-<env>.js file placed in karate-config directory using command prompt:
mvn clean test
-Dkarate.config.dir="D:\Users\KhanAb\Photon-workspace\KarateAPI_MEMT\src\test\java\karate-config
karate-config-test.js" -DargLine="-Dkarate.env=test"
I am getting error because karate is unable to read karate-config-test.js file.
Your path seems wrong, there is a space before karate-config-test.js
Read the documentation: https://github.com/intuit/karate#environment-specific-config
If you still have issues, be specific. If you are still stuck, follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

one file fails to execute pyinstaller

I have been using pyisnataller to create executable applications of my python 3.6.5 scripts. The scripts are GUI interfaces. I have used a recipe from a previous stackoverflow post: link
It has been effective but am running into a slight snafu trying one file a simple GUI.
Why does the executable fail to run? The temporary folder created has the two files added within about.spec?
Any help would be appreciated!
I would have placed the code, and the spec file here but stackoverflow didnt seem to perform the formatting well enough to send the message. I tried backticks four spaces, a missing line followed by eight space, and
Yes, this is an ill posed question. So, turns out the pyinstaller creates a warn_yourscript_.txt file and the post warnings in the creation of the executable. The file is located in the working directory/build/yourscript/warn_yourscript_.txt. Having looked into the file, there was a warning about not being able to load or missing the TKinter module. The myscript.py was running smoothly under python 3.6.5, but I may have started my script from a starter on the internet and may have been from an earlier python. I have several pythons loaded on my machine, python could find it but pyinstaller could not? I changed out myscript to reflect earlier success with tkinter instead.

netbeans is locking files and preventing saving source files

when working on a remote project, netbeans frequently creates lock files. I get this error message when I try and save:
cannot write to locked file:
It doesn't state where the lock file is, and I don't see any obvious lock files.
The solution appears to be to abandon the file, and restart netbeans.
Is there a better way?

___jb_bak___ and ___jb_old___ files in PyCharm

When I got some PyCharm project from my colleague I saw some backup files of *.py files.
This files have types: *.___jb_old___ and *.___jb_bak___.
I open the files in Notepad++ and see that these are identical backup files of the corresponding *.py files.
I asked my colleague, but he didn't know what these are.
Why are there TWO identical backup files for each *.py file?
How can I tune PyCharm? We want to turn off this backup.
Google gave me nothing :(
You can disable "safe write"
Use "safe write" (save changes to a temporary file first) If this
check box is selected, a changed file will be first saved to a
temporary file; if the save operation is completed successfully, the
original file is deleted, and the temporary file is renamed.
https://www.jetbrains.com/webstorm/help/system-settings.html
i had this problem in webstorm when a script file was running and i was editing it in webstorm. when i stopped the script and edited it everything was fine
it's a temporary file used by PyCharm to make sure you change will not be lost when editing files. it's safe to delete them manually, you will only loss very recent changes. IntelliJ IDEA works the same as PyCharm.
How to delete them?
To delete a file on a file system requires two things: 1)you have the permission. 2)no program is using it.
so make sure you have 'w' the permission, and stop all program which is using it. then you can remove it.
How to know which program is using it?
Normally you should already know it. but sometimes some background programs(like crash plan, google drive sync, e.g.) may also hold it quietly, then find and kill all programs may be very tricky. the easiest way is reboot your computer with 'safe mode', in which only the OS kernel is loaded.
I spend two hours to figure out the reason why I cannot delete the temp file even when I have whole permission. a crash plan service is holding it in background. This may not be your issue, but if you cannot delete the temp file, this will save your time.
While JeremyWeir's solution probably does work, the real fix - imo - is to enable write permission on the directory.
Saving a file would only need write permission to that file itself. But with the "safe write", you need permission to create the file and rename it - which means you need write access to the directory.
In Linux this would be e.g. chmod ug+w DIR, if you want to give write access to user and group.
I have exact same issue with PhpStorm after system crash. The fix I found was to manualy delete *._jb_old_ and *._jb_bak_ files and reinstall PhpStorm

Launching a JAR file using Apache as a background process

I have a data parsing utility in the form of a runnable JAR file. I also have an Apache server (Ubuntu 12.04) to which data files are uploaded. Is there anyway that I could launch said JAR file as a background process when a file is uploaded? (FYI: File access by multiple processes isn't a concern here; I've got file locking in place.)
Related idea: if the above isn't possible, I could always launch the aforementioned JAR file from a bash script. However, I'm still not sure how to do that via Apache. I'm quite a novice at using it effectively.
Edit: Just noticed this potential php solution. Apache folks: is this a good idea, or is there a better solution?
Maybe you can use File Alternation Monitor to achieve this. It can be configured as a background daemon which performs operations if the new file is spotted. If you want to avoid starting while the file is currently uploaded, wait approx. 5 minutes after the file change time and start processing your utility.
I use a similar technique for monitoring uploaded files on a Samba share and it works flawless.