why two paths give different results?

I am trying to open the same file but first I tried on my desktop and everything was fine

set unicodeTxt to (read ("/Users/username/desktop/ttbook.txt" as POSIX file) as Unicode text)

then I moved the file and changed the path to

set unicodeTxt to (read ("/Users/username/Music/Audio_Hijack/paprimage/ttbooktitle/ttbook.txt" as POSIX file) as Unicode text)

and got an error
Folder file HD:Users:username:Music:Audio_Hijack:paparimage:ttbooktitle:ttbook.txt wasn’t found
why does the path change the action and how do I correct it?

It’s easier to debug when your script is not crunched. You can then walk through the statements and easily modify the script:

set uPath to "/Users/username/Music/Audio_Hijack/paprimage/ttbooktitle/ttbook.txt"
set fileSpec to uPath as POSIX file
set unicodeTxt to read fileSpec as Unicode text

You can change the line:

set uPath to “/Users/username/Music/Audio_Hijack/paprimage/ttbooktitle/ttbook.txt”
set fileRef to uPath as POSIX file as alias
set unicodeTxt to read fileRef as Unicode text

and it will error if the file is not found. You can get a unix name path to the file (to double check) with:

set f to choose file
set uPath to posix path of f


Thanks kel,
that worked great!