Make a file writable in order to add new packages
Changing the security setting on the R folder to "full control" fixed this for me. See the third posting down at this link for step by step instructions: Unable to update R packages in default library on Windows 7
Unable to update R packages in default library on Windows 7
Usually you need administrator rights to change things in program files. Try running RGui as administrator.
Writing to a new file if it doesn't exist, and appending to a file if it does
It's not clear to me exactly where the high-score that you're interested in is stored, but the code below should be what you need to check if the file exists and append to it if desired. I prefer this method to the "try/except".
import os
player = 'bob'
filename = player+'.txt'
if os.path.exists(filename):
append_write = 'a' # append if already exists
else:
append_write = 'w' # make a new file if not
highscore = open(filename,append_write)
highscore.write("Username: " + player + '\n')
highscore.close()
How can I make directory writable?
chmod 777 <directory>
This will give you execute/read/write privileges. You can play with the numbers to finely tune your desired permissions.
Here is the wiki with great examples.
How to give Read/Write permissions to a Folder during installation using .NET
By default Users group doesn't have write access in per-machine locations like Program Files. This is a Windows standard which is not related to installations. However, during install you can set any permissions you want.
Windows Installer does support custom permissions, but Visual Studio doesn't offer a way for setting them. So the only solution in Visual Studio is a custom action.
Unfortunately Visual Studio doesn't support attached custom actions. So using XCACLS.EXE to set permissions would work only if you include it in your package (it will be installed on the target machine along with your files).
A cleaner, but more complex solution is to write a custom action yourself (using custom code) to set the permissions you want.
The fastest and cleanest solution would be to use a different setup authoring tool which offers more control over permissions.
Updating Anaconda fails: Environment Not Writable Error
start your command prompt with run as administrator
Related Topics
How to Change the Now Deprecated Dplyr::Funs() Which Includes an Ifelse Argument
Subset Rows According to a Range of Time
Merge Dataframes on Matching A, B and *Closest* C
Legend of a Raster Map with Categorical Data
Rounding Time to Nearest Quarter Hour
How to Sort a Character Vector According to a Specific Order
Finding Non-Numeric Data in a Data Frame or Vector
Dplyr Group by Colnames Described as Vector of Strings
Expression and New Line in Plot Labels
Group by and Conditionally Count
How to Order Bars Within All Facets
How to Get All Possible Subsets of a Character Vector in R