Check to see the exact expression used for your Set Variable step. What you show is incorrect, but possibly a typo on your part. It should read:
Set Variable [ $File ; value: GetValue ( Container; 1 ) ]
Yes but it's the "$file =" part that is not correct in your original listing of this script step.
Have you checked to see what text is appearing in $File?
Note that quite a bit of text can be inserted into the container field when you insert a file. The exact text can vary depending on the insertion method used and the storage options specified for the container field.
You may want to use the calculation used in the demo file you can download from this thread on $Path variables, container fields and the script steps that can use them: Exploring the use of a $Path Variable in Scripts
That calculation is designed to extract the file name from a container field no matter what storage option or insertion method was used.