ioexception

Why am I seeing IO Exception using File.Copy() that seems to come from reading a file?

雨燕双飞 提交于 2019-12-11 08:24:48
问题 Preface: I'm very new to coding and mostly self-taught. I'm writing a little app that will automatically copy my game save files to my backup directory. It uses the FileSystemWatcher class to watch a game's save directory and look for changes while I'm playing and calls OnChanged if a file is resized or written to. The problem I'm having is that when my program is copying a file, it sometimes crashes the GAME (in this case Terraria). I'm guessing this has something to do with access

C# - Ways to rename a directory [duplicate]

痴心易碎 提交于 2019-12-11 07:24:21
问题 This question already has answers here : Can't rename directory in C# but manually (3 answers) Closed 6 years ago . I'm using Directory.Move(oldDir, newDir) to rename a directory. Every now and then I get an IOException saying "Access to the path 'oldDir' is denied". However if I right click the directory in the explorer I can rename it without any issues. So my question is: Are there any other ways to rename a directory without using Directory.Move ? I thought of using the command shell (

How do I prevent this System.IO.IOException when copying a file?

隐身守侯 提交于 2019-12-11 06:47:44
问题 When I run the following code to test copying a directory, I get a System.IO.IOException when fileInfo.CopyTo method is being called. The error message is: "The process cannot access the file 'C:\CopyDirectoryTest1\temp.txt' because it is being used by another process." It seems like there's a lock on file1 ("C:\CopyDirectoryTest1\temp.txt") which is created a few lines above where the error is occurring, but I don't know how to release this if so. Any ideas? using System; using System.IO;

IOException access denied when Directory.Move subfolder and parent folder

試著忘記壹切 提交于 2019-12-11 05:45:23
问题 I am trying to rename multiple folders that have subfolders, but when I use Directory.Move() on a subfolder the parent folder seem to get locked up. My code: var pathParent = @"D:\test\f1"; var pathSub = @"D:\test\f1\f2"; var pathParentnew = @"D:\test\f1new"; var pathSubnew = @"D:\test\f1\f2new"; Directory.Move(pathSub, pathSubnew); Directory.Move(pathParent, pathParentnew); The last Directory.Move( ) throws an IOException: Access to "D:\test\f1" is denied Does anyone know how I can rename

What is the reason for java.io.IOException: Underlying input stream returned zero bytes

无人久伴 提交于 2019-12-11 04:07:43
问题 Here is my code, imageFile is a pdf file, intent is to get Base64 encoded file for image file. I am using Java6 and no possibility to upgrade to Java7 Base64Inputstream is of type org.apache.commons.codec.binary.Base64InputStream private File toBase64(File imageFile) throws Exception { LOG.info(this.getClass().getName() + " toBase64 method is called"); System. out.println("toBase64 is called" ); Base64InputStream in = new Base64InputStream(new FileInputStream(imageFile), true ); File f = new

errorCode for The process cannot access the file 'XYZ' because it is being used by another process

99封情书 提交于 2019-12-11 03:47:45
问题 I using C# .NET , vs 2008 , .net 3.5 For me, is difficult, but I need sample code in C# for this: How get the error code of IOException "The process cannot access the file 'XYZ' because it is being used by another process." For example, in my issue. I try delete file, and I get "The process cannot access the file 'XYZ' because it is being used by another process." Exception. try { File.Delete(infoFichero.Ruta); } catch (IOException ex) { // ex.Message == "The process cannot access the file

Unable to start terminal on Pycharm on Ubuntu

醉酒当歌 提交于 2019-12-10 18:50:49
问题 I wanted to run a code, and for that, I installed Pycharm on my Ubuntu Machine. Now. When I opened the Pycharm application and tried to open the terminal, it throws an error and doesn't open the terminal. java.io.IOException: Exec_tty error:Unknown pycharm Additional Notes: I am running Ubuntu 16.04 on Vmware. 回答1: you should set your shell path you could use cat /etc/shells command to see where you shell is then set in pycharm Preferences > Tools > Terminal > Shell path 来源: https:/

IOException message not printed correctly when using Java 9 on Windows 10 set to Japan locale and language

。_饼干妹妹 提交于 2019-12-10 16:28:25
问题 An Exception is thrown in this particular block. try { transport.m_readListener.onReadTransport(transport); } catch (IOException e) { ->onIOException(e,transport); } The onIOException() method puts it on the log: private void onIOException(IOException e, AbstractConnection connection) { String reason = e.getMessage(); ... log.error("Closing ",connection," because ",reason); } The reason variable in Java 8 shows a correct japanese phrase: reason : 既存の接続はリモート ホストに強制的に切断されました 。 (meaning: The

java.io.IOException: Invalid Http response

与世无争的帅哥 提交于 2019-12-10 16:16:32
问题 Now before you say there are questions like this I'd like to point out I've looked over most of them without any luck. Also I'm a first timer here so be gentle. I have this annoyance right now in my current program: Basically this part of my program uses a search engine to find torrent files. public static ArrayList<String> search(String args) throws IOException { args = args.replace(":", ""); ArrayList<String> list = new ArrayList<String>(); URL url = new URL("http://pirateproxy.net/search/"

IOException when dynamically compiling code

孤者浪人 提交于 2019-12-10 13:23:40
问题 I have the following line of code: CSharpCodeProvider c = new CSharpCodeProvider(); CompilerParameters cp = new CompilerParameters(); cp.ReferencedAssemblies.Add("system.dll"); cp.CompilerOptions = "/t:library"; cp.GenerateInMemory = true; CompilerResults cr = c.CompileAssemblyFromSource(cp, sb.ToString()); Which results in an IOException being thrown. Additional information: The process cannot access the file 'C:\Users\Username\AppData\Local\Temp\dgl5fb1i.err' because it is being used by