: error message


I am trying to run and encountering the following error. I tried to look it up in the actual Python script, but haven’t been able to figure out what it’s getting at (My optional arguments seem okay to me. I’m not sure what “trailers” would mean.) Any guidance would be hugely appreciated. Thanks.

The error:
File “/Users/…/abin/”, line 1170
print(‘** ERROR: seem to have trailers, but cannot find them!’)

The shell script -anat ANAT.bc.ns+orig
-epi EPIREF4ANAT.ns.nii
-epi_base 0 -anat2epi -anat_has_skull no
-deoblique on
-epi_strip None -partial_coverage
-master_anat SOURCE -overwrite

The offending line in the Python script:
def get_user_opts(self):
self.valid_opts.check_special_opts(sys.argv) #ZSS March 2014
self.user_opts = read_options(sys.argv, self.valid_opts)
if self.user_opts == None: return 1 #bad
# no options: apply -help
if ( len(self.user_opts.olist) == 0 or
len(sys.argv) <= 1 ) :
ps.ciao(0) # terminate
if self.user_opts.trailers:
opt = self.user_opts.find_opt(‘trailers’)
if not opt:
print “** ERROR: seem to have trailers, but cannot find them!”

I think there may be extra spaces at the end of the lines after the line continuation backslashes

Thanks for your response. The shell script doesn’t show up the same when I c/p it into the forum; originally all the backslashes were aligned. However, I tried it with only one space after arguments, no space, and all arguments on same line. Still same error.

Still seems like a parsing issue from the terminal. Try reducing the problem to the minimum entry to test this out. Use just the -anat, -epi and -epi_base options or even just one of them. The script should exit with a message telling you to put the other non-optional options.


You can try running the file_tool on the file to loook for bad backslashes or other bad characters automatically.

For example:

file_tool -show_bad_backslash -infiles FILENAME

would tell you lines that have a space appearing after a backslash.

More generally,

file_tool -show_bad_all -infiles FILENAME

would highlight some common, known badnesses that can occur in text files when scripting.


Thanks for the suggestion. Unfortunately, even when I just run the following, extremely basic script, the error persists: -anat FT_anat+orig -epi FT_epi_r1+orig -epi_base 0 (even an incomplete script like “ -anat FT_anat+orig” or even just “” by itself results in the same error).

The error again, for reference:
File “/Users/…/abin/”, line 1170
print “** ERROR: seem to have trailers, but cannot find them!”
SyntaxError: Missing parentheses in call to ‘print’

…I also ran file_tool as Paul suggested, and it seemed just fine (“ has 0 bad characters / file type: UNIX”)

Is it possible that something with my Python setup could be messing this up?

Going to jump in here - I feel like I see this error when I forget to use python 2.7 - specifically the missing parentheses portion. I have to activate my anaconda python 2.7 environment before I call AFNI scripts. There may be an easier alternative though, I’m not sure.

Indeed, that last print error is a problem running
with python 3.

But on top of that:

  1. Why does the initial error show “print()” using

  2. Why are you seeing this error message in the
    first place? That program is set up where it should
    never pass into that if condition (trailers).

Are you modifying directly?

  • rick


In regards to the comment from dowdlelt (thank you!), I tried running “deactivate py36” and “activate py27”, which produced a new error, referencing the same area of the script (line 1170): “SyntaxError: Non-ASCII character ‘\xe2’ in file /Users/robertbacker/abin/ on line 1170, but no encoding declared; see for details”. I’m not great with python, so hopefully I did the right thing.

In reply to Rick:
[left]1. My sincere apologies for complicating things! To clarify: the error was in fact: print “** ERROR: seem to have trailers, but cannot find them!”. (The parentheses were in my first post because I was trying to edit an alternative copy of the in an attempt to troubleshoot the code. I dug around and saw that some python versions call for syntax with parentheses. I must have posted the new error by accident. I have not modified the original .py script, nor do I want to! The corrected error in this post stems from the original error from the original .py script.)
2. I wish I knew why I’m seeing it! I even get the error just trying to run something really basic like -anat FT_anat+orig -epi FT_epi_r1+orig -epi_base 0. This wasn’t the case before.[/left]

Is your AFNI version current? I would be positive that
the script is unchanged. That Non-ASCII error suggests
that the script is still edited, and in particular, in a non-Unix
(non plain text) format.

If you are current, try running:

@update.afni.binaries -prog_list

That will just download the current version of the one file.
If you are not current, consider a normal update:

@update.afni.binaries -d

Then try your commands again.

  • rick

I just recently updated AFNI. To be sure there were not issues from my own tinkering, I updated again, however the error remains. Perhaps there’s some unique issue with my Python that I’m just not able to foresee?

I opted to uninstall all Python 3 things by running— -check_all > out.afni_system_check.txt—to check where all the Py3 files were installed and deleting them. Now everything works fine. Thanks for the help everyone.

1 Like