You set conn equal to one of two strings:

if Connection_Type == '1':
    conn = 'Telnet()' 
elif Connection_Type == '2':
    conn = 'SSH2()'

So 'Telnet()'.connect nor 'SSH2()'.connect is going to work.

If you have imported SSH or Telnet from somewhere and presuming they are classes then remove the single quotes and you will create an instance which should work once the classes have a connect method.

 if Connection_Type == '1':
    conn = Telnet()
elif Connection_Type == '2':
    conn = SSH2()
Answer from Padraic Cunningham on Stack Overflow
Discussions

AttributeError: 'str' object has no attribute 'extend' when using custom connect_kwargs and key_filename option
File "/home/dumontj/Projects/a...python3.7/site-packages/fabric/connection.py", line 490, in resolve_connect_kwargs connect_kwargs["key_filename"].extend( AttributeError: 'str' object has no attribute 'extend'... More on github.com
🌐 github.com
12
August 31, 2019
amazon web services - python s3 using boto, says 'attribute error: 'str' object has no attribute 'connection' - Stack Overflow
Now you will get the s3 bucket object. You were getting the string. More on stackoverflow.com
🌐 stackoverflow.com
python - AttributeError: 'str' object has no attribute - Stack Overflow
I'm pretty new to python programming and I wanted to try my hand at a simple text adventure game, but I've immediately stumbled on a roadblock. class userInterface: def __init__(self, roomID, More on stackoverflow.com
🌐 stackoverflow.com
python - AttributeError: 'str' object has no attribute '_execute_on_connection' - Stack Overflow
Traceback (most recent call last): File ~\AppData\Local\Programs\Spyder\Python\lib\site-packages\sqlalchemy\engine\base.py:1410 in execute meth = statement._execute_on_connection AttributeError: 'str' object has no attribute '_execute_on_connection' The above exception was the direct cause ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › fabric › fabric › issues › 2007
AttributeError: 'str' object has no attribute 'extend' when using custom connect_kwargs and key_filename option · Issue #2007 · fabric/fabric
August 31, 2019 - The documentation specifies that key_filename should be given as a string, but I found that it works if you actually give it a list: with fabric.Connection( host=instancePrivateIp, user='ec2-user', config=config, connect_kwargs={ "key_filename": [keyFileName,], }) as c_instance: If this is the wanted syntax, I can update the documentation through a PR (see https://github.com/fabric/fabric/blob/2.0/fabric/connection.py#L234). Otherwise I could change fabric/connection.py to check whether there is already an entry, then transform it into a list if necessary.
Author   joeydumont
🌐
Google Groups
groups.google.com › g › boto-users › c › c_j_zwy0ZkU
Trying to do simple upload: 'str' object has no attribute 'connection'
May 25, 2008 - Hi - You need to pass a Bucket object into the constructor rather than a bucket name. Here's a code snippet that should work for you: >>> c = boto.connect_s3() >>> b = c.lookup('bucket_name') >>> k = b.new_key('key_name') >>> k.set_contents_from_string('this is a test') If you are uploading large files, the best way is to use set_contents_from_file (which takes a file pointer as an argument) or set_contents_from_filename (which takes the fully qualified path to the file to be uploaded).
Find elsewhere
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 285737 › attributeerror-str-object-has-no-attribute
python - AttributeError: 'str' object has no attribute [SOLVED] | DaniWeb
In berrol.setLocation(berrol, well), the first argument after self is redundant (methods get self automatically), and the second looks like a place name, not a Place object. Pick one representation and stick to it. A simple pattern is: Person.set_location(place_key: str) and store places in a dict by key. Also note that your occupants is a tuple; tuples are immutable, so calling .remove on it will raise an AttributeError.
🌐
Reddit
reddit.com › r/learnpython › 'str' object has no attribute error?
r/learnpython on Reddit: 'Str' object has no attribute error?
November 9, 2023 -

I have some experience with programming in Java, C++, etc. and I am trying to write a simple "To-Do List" program to get used to Python. I'm running into the error: str object has no attribute "completed" when trying to iterate over the list of tasks, check their completion status, and display them.

Here are some relevant pieces of the program:

Constructor for the Task class

def __init__(self, task_name):

self.task_name = task_name

self.completed = False

In the ToDoList class (which holds a list of the task instances created by the user) this is the iteration throwing the error in question:

for idx, task in enumerate(self.tasks, start=1):

status = "Completed" if task.completed else "Incomplete"

print(f"{idx}. {task.task_name} - {status}")

I thought, potentially the problem lies in the fact that the enumerate function is grabbing the string value of the task instance, rather than the object itself, so maybe I can iterate over it the old fashioned way and get around it. So I tried it like this:

counter = 1

for task in self.tasks:

status = "Completed" if task.completed else "Incomplete"

print(f"{counter}. {task.task_name} - {status}")

counter += 1

Yet, it throws the same error. I know there is something I am missing or not understanding correctly here. What is it?

Thanks!

🌐
Brainly
brainly.com › engineering › college › what does "str object has no attribute" mean in python?
[FREE] What does "str object has no attribute" mean in Python? - brainly.com
The error "AttributeError: 'str' object has no attribute" occurs when trying to access a method that does not exist on string objects in Python. To resolve this issue, check the method name, consult documentation, and use dir() to inspect string ...
🌐
Medium
medium.com › @pies052022 › attributeerror-str-object-has-no-attribute-str-solved-8a22b6395f33
AttributeError: ‘str’ object has no attribute ‘str’ [Solved] | by JOKEN VILLANUEVA | Medium
January 29, 2025 - The AttributeError: ‘str’ object has no attribute ‘str’ means that you are trying to call the “str” attribute or method on a string object.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-str-object-has-no-attribute
AttributeError: 'str' object has no attribute 'X in Python | bobbyhadz
April 8, 2024 - The Python "AttributeError: 'str' object has no attribute" occurs when we try to access an attribute that doesn't exist on string objects.
🌐
Career Karma
careerkarma.com › blog › python › python attributeerror: ‘str’ object has no attribute ‘append’ solution
Python AttributeError: ‘str’ object has no attribute ‘append’ Solution
December 1, 2023 - To solve this error, use the concatenation operator (+) to add items to the end of a string. Now you’re ready to solve this common Python error like an expert! About us: Career Karma is a platform designed to help job seekers find, research, ...
🌐
Esri Community
community.esri.com › t5 › arcgis-api-for-python-questions › str-object-has-no-attribute › td-p › 1053478
Solved: 'str' object has no attribute - Esri Community
September 14, 2021 - Searching through the other messages hasn't helped me with this. I like to figure things out on my own, but I'm stumped. I copied the deep_copy_content part below from a technical article, and only changed item.title to itemid and switched "gis" and "gis2". Otherwise it's the same. "gis" is my target location. Here's what I'm seeing. I appreciate any suggestions. Solved! Go to Solution. ... The clone_items function takes a list of Items. It seems like you are passing in the string item ids instead.
🌐
Splunk Community
community.splunk.com › t5 › All-Apps-and-Add-ons › str-object-has-no-attribute-get › m-p › 744287
'str' object has no attribute 'get' - Splunk Community
April 16, 2025 - The .get() method is designed for dictionaries to retrieve values associated with keys, not for strings. ... Get Updates on the Splunk Community! In cybersecurity, defenders respond to threats. Architects design the systems that stop them. As ... In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ... If you’re running Kubernetes at scale, you know the pain of fragmented workflows, noisy environments, and too ...
🌐
Reddit
reddit.com › r/learnpython › how do i fix this : attributeerror: 'str' object has no attribute 'current'
r/learnpython on Reddit: How do i fix this : AttributeError: 'str' object has no attribute 'current'
December 7, 2023 -

There is something wrong with this function. It shows no errors, but when I try to run it, It says AttributeError: 'str' object has no attribute 'current'. (BTW, i am trying to run it as a flet on spyder)

def leapyears(e):

days_in_month = {1: 31, 3: 31, 4: 30, 5:31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31 }

month = int(EnterMonth_text.value)

year = int(EnterYear_text.value)

if year % 100 == 0:

if year % 400 == 0:

leap_year = True

elif year % 4 == 0:

leap_year = True

else:

leap_year = False

if month == 2 :

if leap_year:

days_in_month[2] = 29

else:

days_in_month[2]= 28

output_textfield.value= days_in_month[month]

page.update()

🌐
Brainly
brainly.com › computers and technology › high school › how can you fix "attributeerror: 'str' object has no attribute 'append'"?
[FREE] How can you fix "AttributeError: 'str' object has no attribute 'append'"? - brainly.com
November 19, 2023 - Python's official documentation states that strings are immutable, and therefore, methods like append() are available for list objects, not string objects. This confirms the reason why attempting to use append on a string results in an AttributeError. ... You are experiencing issues when trying to transfer files between two computers using FTP. What could be the potential cause(s) of the issue ... describe what happens at every step of our network model, when a node on one network establishes a TCP connection with a node on another network.
🌐
Reddit
reddit.com › r › learnpython › comments › g12q25 › attributeerror_str_object_has_no_attribute_no
r/learnpython - AttributeError: 'str' object has no attribute 'no' #PLEASE HELP ME
April 14, 2020 -

import socket

class data_pembalap :

def __init__(self,post,no,nama,origin,team,besttime="",tottime=""):

self.pos = post

self.no = no

self.nama = nama

self.origin = origin

self.team = team

self.best_time = besttime

self.total_time = tottime

pembalap = []

def search(no):

for x in range(len(pembalap)):

if pembalap[x].no == no :

return x

return -1

def insert_info(no ,nama ,origin ,team):

x = search(no)

if x >= 0:

pembalap[x].nama = nama

pembalap[x].origin = origin

pemabalap[x].team = team

else:

pembalap.append(data_pembalap(no,nama,origin,team))

def insert_pos(no,pos,total_time):

x = search(no)

if x>=0:

pembalap[x].pos = pos

pembalap[x].total_time = total_time

else:

pass

#pembalap.append( data_pembalap( pos ,no ,total_time))

def insert_time(no,btime ,totime):

x = search (no)

if x>=0:

pembalap[x].best_time = btime

pembalap[x].total_time = totime

else:

pass

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:

s.connect(("192.168.100.33" , 50000))

while True:

orbit_data = s.recv(1024)

if not orbit_data:

break

pembalap = orbit_data.decode("utf-8").replace('\"', ' ').split('\r\n')

for x in pembalap:

x = x.split(',')

if x[0] == '$COMP' and len (x) > 7:

no = (x[1])

nama = x[4] + ' ' + x[5]

origin = (x[6])

team = (x[7])

insert_info(no,nama,origin,team)

if x[0] == '$G' and len(x) > 4:

no = (x[2])

pos = (x[1])

total_time=(x[3])

insert_pos(no,pos,total_time)

if x[0] == '$B' and len (x) > 1:

on_track = x[2]

print (on_track)

if x[0] == '$J' and len(x) > 2:

no = x[1]

bs = x[2].replace( '00:','' )

lt = x[3]

insert_time(no,bs,lt)

x = search(no)

all = pembalap.pos ,pembalap.no ,pembalap.nama ,pembalap.origin ,pembalap.btime,

print(all)

****************************************************

Traceback (most recent call last):

File "D:/noname/venv/kon.py", line 69, in <module>

insert_pos(no,pos,total_time)

File "D:/noname/venv/kon.py", line 32, in insert_pos

x = search(no)

File "D:/noname/venv/kon.py", line 17, in search

if pembalap[x].no == no :

AttributeError: 'str' object has no attribute 'no'

🌐
Reddit
reddit.com › r/learnpython › attributeerror: 'str' object has no attribute 'text'
r/learnpython on Reddit: AttributeError: 'str' object has no attribute 'text'
December 30, 2021 -

I'm getting the error which I wrote on the title. This is the code:

town = requests.get("http://earthmc-api.herokuapp.com/towns/" + town)

content = town.content

print(str(content).text)

Error:

AttributeError: 'str' object has no attribute 'text'

How can I fix it?

The result for print(type(town.content)) is:

<class 'bytes'>

If I try to do town.content.text, then it says AttributeError: 'bytes' object has no attribute 'text'

That's the town.content as string:

b'"That town does not exist!"'

But it should be like:

"That town does not exist!"

That's why I'm using .text, and it throws me the error.