Now we use CSS(Control System Studio) to control a Pilatus Detector. The platform is base-3.14.12.3,
synApps_5_6 and CSS_3.1.6, the driver of Pilatus Detector is from synApps_5_6.

When I use the softioc and the CSS opi to control the
Detector, it works well and no problem, but now I have a python script to modify the detector’s Filename and Filename readback for exposing some different samples. That is, when I execute the python
script it can modify the record X16B:EH:13PIL1:cam1:Filename and X16B:EH:13PIL1:cam1:Filename_RBV automaticly, the python is as follows（sample.py）:

The sample_name is from the css opi for different sample’s name, for example,in a experiment you can do six samples, that is,
the sample.py will be run for six times.

The problem is, if the first sample name is sample1, the python can modify the two record, and the detector file name will be sample1_0001.tif, it works well. But when I set the
second sample’s name is s2, the detector file name will be
s2mple1_0002.tif, which is not I wanted. That is , the first two letter is replaced by s2, but the sample’s name is not replaced all. I don’t know why.

When I open a terminal in linux, and input python, and then run statement of the sample.py line by line, the problems is the same. That is to say, if the next sample’s name is
shorter than former, the question is exist, on the contrary, it’s ok.