# Cannot run macro

**URL:** <https://root-forum.cern.ch/t/cannot-run-macro/54466>\
**Category:** Newbie\
**Created:** [April 13, 2023, 9:45am UTC](https://root-forum.cern.ch/t/cannot-run-macro/54466 "2023-04-13T09:45:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sabiha\_Tasneem\_JC](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sabiha_tasneem_jc/32/33072_2.png) [@Sabiha\_Tasneem\_JC](https://root-forum.cern.ch/u/Sabiha_Tasneem_JC)\
**Post date:** [April 13, 2023, 9:45am UTC](https://root-forum.cern.ch/t/cannot-run-macro/54466/1 "2023-04-13T09:45:44Z")

</div>

i am working in root. i have a code to open a root file, retrieve a histogram and find integral of a given range. but my code is not working. the code is working in my supervisor’s computer, but not in my computer. how can i solve this problem?

this platform is not allowing me to share the error messages here, hence i couldn’t specify my problem.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 13, 2023, 9:48am UTC](https://root-forum.cern.ch/t/cannot-run-macro/54466/2 "2023-04-13T09:48:28Z")

</div>

I guess that your code expects the “root file” in some place which is specific to your “supervisor’s computer” (so you need to “tune” the code to reach the same file on your computer).

---

<div class="post-metadata">

**Author:** ![Sabiha\_Tasneem\_JC](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sabiha_tasneem_jc/32/33072_2.png) [@Sabiha\_Tasneem\_JC](https://root-forum.cern.ch/u/Sabiha_Tasneem_JC)\
**Post date:** [April 13, 2023, 11:09am UTC](https://root-forum.cern.ch/t/cannot-run-macro/54466/3 "2023-04-13T11:09:26Z")

</div>

I am using  
TDirectory to reach the files. definitely i copied the path from file properties and also checked with the command pwd. yet it gives: Unknown directory home or Unknown directory Desktop

If i open root directly from the terminal, it open macros from .:/opt/root/macros  
and hence give error: macro \*\*\*\*.C not found in path  
Here i cannot keep my files as it is restricted. so i have to open my macros from my directory, which i cannot as stated before.

what to do?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 13, 2023, 12:07pm UTC](https://root-forum.cern.ch/t/cannot-run-macro/54466/4 "2023-04-13T12:07:15Z")

</div>

`cd /where/you/have/private/macros ; root some_macro.C`  
or:  
`cd /your/working/directory ; root /where/you/have/private/macros/some_macro.C`
