# AttributeError: 'TObject' object has no attribute 'SetLineColor'

**URL:** <https://root-forum.cern.ch/t/attributeerror-tobject-object-has-no-attribute-setlinecolor/50649>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [July 4, 2022, 7:49am UTC](https://root-forum.cern.ch/t/attributeerror-tobject-object-has-no-attribute-setlinecolor/50649 "2022-07-04T07:49:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![beg1nner](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@beg1nner](https://root-forum.cern.ch/u/beg1nner)\
**Post date:** [July 4, 2022, 7:49am UTC](https://root-forum.cern.ch/t/attributeerror-tobject-object-has-no-attribute-setlinecolor/50649/1 "2022-07-04T07:49:44Z")

</div>

Dear experts,

I have a script in python that uses ROOT and I am getting a following error:

> AttributeError: ‘TObject’ object has no attribute ‘SetLineColor’

for this line: `gr.SetLineColor(ROOT.kViolet)` .

Could you please tell me what could be wrong here? I suppose there are some problems with the python or ROOT versions that I use?

I use Python 2.7.14+ and ROOT 6.12/07.

I hope that with this information it is possible to find out what’s wrong.

Thank you!

Newbie

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [July 4, 2022, 8:11am UTC](https://root-forum.cern.ch/t/attributeerror-tobject-object-has-no-attribute-setlinecolor/50649/2 "2022-07-04T08:11:21Z")

</div>

> [@beg1nner](#):
>
> Could you please tell me what could be wrong here?

You are trying to set the line color of a TObject. TObject does not inherit from Tattling there it does not have the SetLineColor method. You should tell use a bit more. Show your code so we can see what `gr` should be (very likely a TGraph I guess).

---

<div class="post-metadata">

**Author:** ![beg1nner](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@beg1nner](https://root-forum.cern.ch/u/beg1nner)\
**Post date:** [July 4, 2022, 8:25am UTC](https://root-forum.cern.ch/t/attributeerror-tobject-object-has-no-attribute-setlinecolor/50649/3 "2022-07-04T08:25:44Z")

</div>

Dear @couet ,

Yes, it is a TGraph. I think I found the problem. It was trying to access a TGraph from a file, which did not exist, and for some reason it gave the AttributeError instead of saying that the graph that I am trying to access does not exist. Weird, but at least the issue seems to be found.

Thank you for your time!
