Jump to content




Getting access denied... O_o

help

  • You cannot reply to this topic
10 replies to this topic

#1 diamondpumpkin

  • Members
  • 59 posts
  • LocationPlaces, Ukraine

Posted 16 March 2016 - 02:29 AM

I'm trying to move a file from my disk drive to my computer, and I'm getting access denied... I do have another computer next to it, but when it's off it does the same thing.

Code:
http://imgur.com/svWE28a

Line 9 is the one giving the error.

Edited by diamondpumpkin, 16 March 2016 - 02:32 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 16 March 2016 - 02:52 AM

Don't neglect to close your file handles (eg "h") when you're done with them. You may also have a handle persisting on the local "temp" file, in which case rebooting the computer should clear it.

#3 diamondpumpkin

  • Members
  • 59 posts
  • LocationPlaces, Ukraine

Posted 16 March 2016 - 02:58 AM

View PostBomb Bloke, on 16 March 2016 - 02:52 AM, said:

Don't neglect to close your file handles (eg "h") when you're done with them. You may also have a handle persisting on the local "temp" file, in which case rebooting the computer should clear it.

I've restarted multiple times, and I've added the close to the one you suggested.

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 16 March 2016 - 08:53 AM

And should I assume you're getting the same error on the same line?

Alright, what's fs.getFreeSpace("") returning?

#5 diamondpumpkin

  • Members
  • 59 posts
  • LocationPlaces, Ukraine

Posted 16 March 2016 - 06:27 PM

View PostBomb Bloke, on 16 March 2016 - 08:53 AM, said:

And should I assume you're getting the same error on the same line?

Alright, what's fs.getFreeSpace("") returning?
Yes, it's still access denied on line 9.

The space is:
997976

Edit: Something that may be worth saying, when I run the program, it copies the file onto the computer BUT doesn't move it from the disk to the computer. So, basically, it's copy with an error.

Edited by diamondpumpkin, 16 March 2016 - 06:32 PM.


#6 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 16 March 2016 - 07:08 PM

View Postdiamondpumpkin, on 16 March 2016 - 06:27 PM, said:

View PostBomb Bloke, on 16 March 2016 - 08:53 AM, said:

And should I assume you're getting the same error on the same line?

Alright, what's fs.getFreeSpace("") returning?
Yes, it's still access denied on line 9.

The space is:
997976

Edit: Something that may be worth saying, when I run the program, it copies the file onto the computer BUT doesn't move it from the disk to the computer. So, basically, it's copy with an error.
To close your file, which you need to do if moving or deleting the file thats open you would do this
 local h = fs.open( AlocatedFile, "r")
local j = h.readLine() --# you dont have to declare a line number

h.close() --# this will close the file allowing you to do what you want to do IE: move the file

Always remeber to close the file after you have read the lines you need or you will always get "Access Denined"

Hope this works :P

#7 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 16 March 2016 - 07:09 PM

View PostBomb Bloke, on 16 March 2016 - 02:52 AM, said:

Don't neglect to close your file handles (eg "h") when you're done with them. You may also have a handle persisting on the local "temp" file, in which case rebooting the computer should clear it.

View PostMr_Programmer, on 16 March 2016 - 07:08 PM, said:

To close your file, which you need to do if moving or deleting the file thats open you would do this
 local h = fs.open( AlocatedFile, "r")
local j = h.readLine() --# you dont have to declare a line number

h.close() --# this will close the file allowing you to do what you want to do IE: move the file

Always remeber to close the file after you have read the lines you need or you will always get "Access Denined"

Hope this works :P
A bit late. Of course he might of done it wrong, but still a bit late :P

Edited by Dragon53535, 16 March 2016 - 07:10 PM.


#8 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 16 March 2016 - 07:11 PM

View PostDragon53535, on 16 March 2016 - 07:09 PM, said:

View PostBomb Bloke, on 16 March 2016 - 02:52 AM, said:

Don't neglect to close your file handles (eg "h") when you're done with them. You may also have a handle persisting on the local "temp" file, in which case rebooting the computer should clear it.

View PostMr_Programmer, on 16 March 2016 - 07:08 PM, said:

To close your file, which you need to do if moving or deleting the file thats open you would do this
 local h = fs.open( AlocatedFile, "r")
local j = h.readLine() --# you dont have to declare a line number

h.close() --# this will close the file allowing you to do what you want to do IE: move the file

Always remeber to close the file after you have read the lines you need or you will always get "Access Denined"

Hope this works :P
A bit late
I mean reboting the computer ever time to solve the issue isnt a effective way of sorting it out, hence why i posted what i posted

#9 diamondpumpkin

  • Members
  • 59 posts
  • LocationPlaces, Ukraine

Posted 16 March 2016 - 08:03 PM

Quote

To close your file, which you need to do if moving or deleting the file thats open you would do this
 local h = fs.open( AlocatedFile, "r")
local j = h.readLine() --# you dont have to declare a line number

h.close() --# this will close the file allowing you to do what you want to do IE: move the file

Always remeber to close the file after you have read the lines you need or you will always get "Access Denined"

Hope this works :P

I am well aware of this, I've closed it when Bomb Bloke said something. However, it's still not working.

Edited by diamondpumpkin, 16 March 2016 - 08:04 PM.


#10 Mr_Programmer

  • Members
  • 95 posts
  • LocationA CPU some where in Bolton, UK

Posted 16 March 2016 - 08:09 PM

Quote

I am well aware of this, I've closed it when Bomb Bloke said something. However, it's still not working.
and it is still syaing the is a error on line 9, i have read thought the code mulitple times and cant seam to see what the problem is at all!

Could you post the rest of your code or upload it to pastebin and give the link just so i can read though everything?

#11 diamondpumpkin

  • Members
  • 59 posts
  • LocationPlaces, Ukraine

Posted 16 March 2016 - 08:12 PM

View PostMr_Programmer, on 16 March 2016 - 08:09 PM, said:

Quote

I am well aware of this, I've closed it when Bomb Bloke said something. However, it's still not working.
and it is still syaing the is a error on line 9, i have read thought the code mulitple times and cant seam to see what the problem is at all!

Could you post the rest of your code or upload it to pastebin and give the link just so i can read though everything?

I'm new to Lua/computercraft could you tell me how to upload it to pastebin? Or would I have to type it?

Edit: Figured it out on my own, rather easy.
Here is the pastebin:
http://pastebin.com/aPzvAFsR
here is the one that's getting the error:
http://pastebin.com/UwG9rMhz
Line 18

If you're wondering how I got from line 9 to 18, I was messing around with the code a little and managed to sneak the file into the computer I was having trouble with first by coping it and attempting to delete the file after it was copied with another computer. The second part failed.

Edit: I believe I found the problem... Since I was terminating the startup, it didn't have a chance to close the file, thus giving the problem. I'm going to double check before I say problem solved.

Edit once more: Yes, terminating the program before it closed the file threw the error access denied. Restarting worked, just that the program I terminated was startup...

Edited by diamondpumpkin, 16 March 2016 - 10:20 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users