21

When I try to add a word or to ignore all, Aspell throws the error 'the file "C:/Program Files (x86)/Aspell/en.pws" cannot be opened for writing'. Anyone know what is causing this problem and how to fix it?

Elliot
  • 5,211
  • 10
  • 42
  • 70

6 Answers6

19

Ensure that the security settings of the "C:/Program Files (x86)/Aspell" folder for the current user allow for modifying and writing.

I had the same issue, and this cleared it right up.

TAllen
  • 214
  • 3
  • 3
  • 6
    This is actually a work-around for the bad-chosen location to store the user data inside the application folder. Aspell should better set this to %appdata%, an path to something like C:\Users\\AppData\Roaming\. – R. Schreurs Jan 01 '12 at 19:37
  • R. Schreurs, how could one fix this? – Jess Riedel Jan 20 '14 at 23:02
15

Here is some help to the missing en.pws and en.prepl files. I have no idea why the developers failed to provide this simple solution for windows.

  1. Go to the directory of "Aspell", which should have been installed as a sub-directory of NotePad++.
  2. Right click in the main Aspell directory, choose "New" then choose "text document".
  3. Rename the new text document as "en.pws" (without quotes) removing the "txt" extension, press enter key.
  4. Repeat, make another new text document and rename it to "en.prepl".
  5. Open up en.pws in NotePad++
  6. copy and paste the following into en.pws, exactly as below;

    personal_ws-1.1 en 2
    µÄ
    

    (Note: the µÄ symbols are below, on a new line below personal_ws-1.1 en 2)

  7. Go to the Menu in NotePad++, click "Encoding" and make sure that "Encoding ANSI" is chosen (Dot beside it).

  8. Save file and close file.
  9. Open the en.prepl file in NotePad++
  10. Copy and paste the following into that file;

    personal_repl-1.1 en 0 
    
  11. Same, make sure the "Encode ANSI" is chosen.

  12. Save and close file.

Note: you must close each file before using NotePad++ Spell Checker and "learn" button. Else it corrupts the file and you have to redo it.

NotePad++ will now work and you can save words to the ".pws" file.

sth
  • 222,467
  • 53
  • 283
  • 367
Mark
  • 151
  • 1
  • 2
  • I got the error about not being able to open the file after I clicked learn but then the spell check continued. After spell check was done, it alerted me with "Done" and now when I use it, I no longer get the error. :thumbup: – HPWD Dec 06 '12 at 16:18
  • +1 : although the solutions works, is unnecessary since enabling modifying and writing permission (as in the accepted answer) would be enough. en.pws and en.prepl files will be created automatically if they don't exist. – JFK May 08 '13 at 19:08
  • Thank you, I tried the permissions route and it would not accept the permissions change, so these steps were very helpful. – Niseonna May 29 '16 at 17:39
  • @JFK, not always I guess. They weren't created automatically in my case. – Corio Sep 15 '17 at 14:45
  • @Corio Well, my comment was true back in May 2013 and that was loooong time ago. Things may have changed for sure – JFK Sep 23 '17 at 03:10
6

Possible locations of GNU Aspell custom words file:

%localappdata%\VirtualStore\Program Files\Aspell
%programfiles%\Aspell

For English for example the custom words file is named en.pws (file name = language code) and the very first line must look like:

personal_ws-1.1 en 286

Where "en" is the file name (=language) and 286 are the number of words (lines) in that file. Last line must is always empty. GNU Aspell does not allow words ending with a number (e.g. Beta1). If you have such a word in your pws file Aspell or the application that uses it (e.g. Notepad++) may crash/hang ...

You may have to delete your en.pws file and create a new one (e.g. using Notepad++). File format as described above, otherwise GNU Aspell will fail to work.

hfrmobile
  • 1,213
  • 16
  • 16
  • I my case, you're assumption on the cause of the error does not apply. I have done a clean installation on Windows 7. I am using Aspell from within Notepad++. Notepad++ simply does not have the permission to create a file in %programfiles%\Aspell, when running in normal user mode, even if this user is in the Local Adminstators group. This is standard behaviour of Windows 7. – R. Schreurs Jan 01 '12 at 19:32
  • So how does one get ASpell to place the en.pws file in one of those locations? – Adrian Jun 26 '15 at 12:51
1

I took the read only off of "C:/Program Files/Aspell" folder. N++ still says

GNU Aspell

Error: The file "C:/Program Files/Aspell/en.pws can not be opened for writing.

The english .50 dictionary install does not do a proper install into your C:/Program Files/Aspell directories. I had to open the Installer .EXE in WinRAR and copy the folders.

Should I copy the English dictionalry installer into my C:/Program Files/Aspell folder and install from there?

  • "Read Only" is a file attribute, you have not changed the directory's security. Right click the directory, properties and then use the security tab to allow access. – Mesh Jan 25 '11 at 09:29
1

"Ensure that the security settings of the "C:/Program Files (x86)/Aspell" folder for the current user allow for modifying and writing"

"I took the read only off of "C:/Program Files/Aspell" folder. [The error message remains]"

It's not a read-only problem, but permissions. In Security give "Users" "Full control" over the .prepl and .pws files.

pol098
  • 11
  • 1
0

The Answer by "sth" and "Mark" is good, but it still has permissions issues in Windows 10. Instead of creating the two files in the Program Files folder for Aspell, create and initialize them on your desktop first; that will give your account full control on the files. (Also, set the encoding before you paste the initializing text.) Then move the two files into the Program Files folder for Aspell, and they will retain the full write permissions of your account without messing with the overall permissions of the Program Files folder for Aspell.

JediSQL
  • 21
  • 4