Home > Enterprise >  Python3: NameError: name 'raw_input' is not defined
Python3: NameError: name 'raw_input' is not defined

Time:12-18

Here is part of a script that causes the error:

File "/home/bcramer/workdir-aptaNET/feature_extraction.py", line 28, in <module>
    apt=raw_input('GGGAGWAVIPV')

NameError: name 'raw_input' is not defined
# ##########################################
##pseAAC encoding
from sys import argv
import string

#20 native amino acids according to the alphabetical order of their single-letter codes
aa_20 = ['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y']

#count_amino_acids
apt=raw_input('GGGAGWAVIPV')

target=raw_input("SGFRKMAFPSGKVEGCMVQVTCGTTTLNGLWLDDVVY")

Below is the original code written by the script author:

#count_amino_acids
apt=raw_input('Please Enter Aptamer Sequence:')

target=raw_input("Please Enter Protein Sequence:")

CodePudding user response:

raw_input is a function that's available in Python 2. Python 3 renamed it to input. You should either amend your script accordingly, or use a Python version from the 2.x generation (probably the latest 2.7).

CodePudding user response:

Issue is that raw_input is input in Python 3.

apt=input('GGGAGWAVIPV')    
target=input("SGFRKMAFPSGKVEGCMVQVTCGTTTLNGLWLDDVVY")
  • Related