Cant save or run files on spyder, bad file descriptor - spyder

I cannot run or save any files in spyder, I made a file as simple as print('hi') and tried to save it as test.py, but it gave me an error file not found. If I try to open and save to an existing file it says unable to save file errno 9 bad file descriptor.

The issue is not related to spyder but with Windows 10.
Windows 10 is not allowing untrusted applications to make changes in protected folders, therefore untrusted spyder cannot make changes (save files) in protected folders.
Here's how to resolve this issue:
1. Open Windows Defender --> Home --> Virus & threat protection.
2. Scroll down to Ransomware Protection --> Turn off Controlled folder access.

Related

Release SAS memory

I was running some code on SAS that was generating data and for some reason, it froze. I quit the program and relaunched SAS, but noticed it didn't clear the memory. It's a lot of data, about 20 gigs, so losing that much space is more than I'm willing to give up. Normally, when I close and relaunch SAS it clears that memory, but this time it didn't, even after restarting the desktop (it's a Windows PC on Windows 10). Any suggestions or ideas?
Sometimes runaway processes that do not end gracefully will leave their temporary data in your WORK directory. Here are two ways to do it:
Use cleanwork.exe
Run the following in an elevated command prompt, where C: is the drive SAS is installed and your SAS WORK directory resides.
"C:\Program Files\SASHome\SASFoundation\9.4\cleanwork.exe" /v C:
This will search your entire volume for temporary SAS files and it could take a while. If you want to only clean your WORK directory and make it run faster, you can find it in sas9.cfg file. For example:
"C:\Program Files\SASHome\SASFoundation\9.4\cleanwork.exe" /d "%TEMP%\SAS Temporary Files"
Documentation
Delete it manually from WORK
To get to your WORK directory:
Open SAS
Type the following code:
%put %sysfunc(getoption(work));
Check your log. You'll see something like this:
C:\Path\_TD_<numbers and letters>\<id>
Go to the directory that the _TD is in.
Delete all files/folders in this directory that start with:
#TD
_TD
SAS_util
NOTE: If you are using Enterprise Guide, you can delete everything in the "EGTEMP" folder. If you're having issues deleting temporary files in it, check out Unlocker. It's a bit oldschool but still works on Windows 10! Great little tool.

TFS: Force copy a file that is in use

So in my TFS build, after the compile, I'm trying to copy some dlls over to the server. If they're currently in use, the build will fail.
Is there a way to force the overwrite, even if the file is open?
Thanks!
It's either a service or a desktop application accessing the dll file. You can find out what has access to the file using handle.exe from SysInternals.
Once you know what is accessing the dll file you can stop/kill it.
Moreover, there are also many other ways which can bypass the system prompts. However, it seems no one fit your situation. More ways to achieve force copy for you reference: How to copy "in use" files through batch file in Windows 7

VirtualStore for delphi application

I use opendialog to load file to application path . is there any way to load the file to %userprofile% > AppData > Local > VirtualStore > Program Files > MyApplication Folder, it is because users should not see the the loaded file
Windows will automatically show applications the "VirtualStore" files for old applications. This is done to try and make sure that old applications build before UAC continue to run correctly. To turn off this behavior you need to add a application manifest to your program. This will make windows turn off the VirtualStore behavior both for files and registry entries.
Here is a good page that describes what is happening in detail:
http://www.codeproject.com/Articles/17968/Making-Your-Application-UAC-Aware
The manifest is an XML resource file that can be embedded into the application. In terms of UAC, this serves 2 purposes. Firstly it tells the operating system that the application has been designed with UAC in mind, and that it therefore should not attempt to virtualize any folders or registry settings. If the application still attempts to access protected resources after making its declaration, then these requests will simply fail rather than virtualize. The other thing it does is allow the application to state the privilege level at which it needs to run, and whether it requires elevation.
There are several questions already on StackOverflow that deal with creating and adding an application manifest to Delphi 7 projects. Here is one link to get you started:
Delphi 7 vista / windows 7 manifest
Once you tell windows that you know about the new version of Windows via the manifest you will need to make sure that you are playing by the new rules and don't write data back to any of the protected locations.

when using vs2013,Failed to parse manifest; but worked well on vs2010

recently, My company need me to do something on application cache, and I read this article: http://www.codemag.com/Article/1112051, I followed his steps,but it cannot work by using vs2013, it will show you the right page, but when you press f12 in chrome, it will show some error:Application Cache Error event: "Failed to parse manifest localhost:xxxxx/Home/manifest", and actually app cache didn't work. but when I use vs2010 it works just fine! since vs2013 has a lot more files in the mvc project, I cannot figure out what's wrong. Now I need some vs2013 tools which are not included in vs2010, so I really need the vs2013 version of this app cache program. It's quite in a hurry, can anyone help me? thanks a lot!
Please follow these steps to see if it helps.
Step 1: Run Windows System File Checker("sfc /scannow")
It allows you to scan for file corruption and restore Windows system files such as DebuggerProxy.dll. If System File Checker finds a problem with DebuggerProxy.dll or other critical system file, it will attempt to replace the problematic files from DLL Cache (%WinDir%\System32\Dllcache). If the DebuggerProxy.dll file is not in the DLL Cache, or the DLL Cache is corrupted, you will be prompted to insert the Windows installation disc to recover the original files.
To run System File Checker:
1.Click the Start button.
2.Type "cmd" in the search box... DO NOT hit ENTER yet!
3.While holding CTRL-Shift on your keyboard, hit ENTER.
4.You will be prompted with a permission dialog box.
5.Click Yes.
6.A black box will open with a blinking cursor.
7.Type "sfc /scannow" and hit ENTER.
8.System File Checker will begin scanning for DebuggerProxy.dll and other system file problems (be patient - the system scan may take a while).
9.Follow the on-screen commands.
Step 2:Make sure your ISO installation file is correct.
You can download the ISO file from the website below.
http://www.microsoft.com/en-hk/download/details.aspx?id=40787]
Before you install it, I suggest you use this tool http://support.microsoft.com/kb/841290 to verify hash of the ISO. Any discrepancy would indicate that the file was corrupted. Here is a blog about how to use the tool.
The sha1 value of ISO is "E61419E51F42254EE07DECF628B85C9861286250".
Then try reinstall it.

Delphi copy files to systemdir problem in Windows 7

i can use the copyfile(); function to copy a file to c:/windows/system32 on windows xp but then i use the function on windows 7 i cant copy it:o the file wont come there....
i had the same problem with writing and reading registery but fixed it by declaring a WOW key $0100 ...
i think the problem is uac but not sure.. could somebody explain me that:D?
That is indeed because of UAC. It is called File/Folder or Registry Virtualization. It is done for legacy applications who don't yet respect the new UAC rules (e.g. not writing in system folders unless you are an administrator).
By creating a manifest file you switch off this virtualization. See here. This can be a seperate file or be embedded into the exe. Newer Delphi versions already generate executables containing such a manifest and have requestedExecutionLevel set to asInvoker. This normally does not allow writing in those locations, unless users specifically run your program as an administrator. Setting it to requireAdministrator does allow writing in those locations, but also means users have to confirm they want to run your program as an administrator.
It's indeed UAC that's preventing you from copying files to the system32 folder. You have to ask yourself why you want to copy files there. A normal application should never copy files to the system32 folder.
Sometimes during install you might want to copy dll's there, but even that is legacy behaviour. Should you really want to copy files there, you should request Elevation at the start of the application.
Why are you copying files there? It should be treatead as the OS private directory. Unless you're installing a driver or the like, you should never write there. In XP you can only because you're running with Administrator privileges, try to use a plain user and you can't as well (since at least 2000, if not in NT already), but it will give you an error because it won't redirect the write. Unless you have a truly good reason to write there, I'd suggest to redesign your application to write in the proper place, instead of trying to find a way to write there. Anyway, it will fail anytime the user don't have the privileges and can't perform an elevation.

Resources