# Write .pvd error

**URL:** <https://fenicsproject.discourse.group/t/write-pvd-error/2427>\
**Category:** I/O\
**Created:** [February 12, 2020, 4:22pm UTC](https://fenicsproject.discourse.group/t/write-pvd-error/2427 "2020-02-12T16:22:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scsicv](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@scsicv](https://fenicsproject.discourse.group/u/scsicv)\
**Post date:** [February 12, 2020, 4:22pm UTC](https://fenicsproject.discourse.group/t/write-pvd-error/2427/1 "2020-02-12T16:22:49Z")

</div>

Hello,

May I ask if you can please help me resolve the following error:

\*\*\* -------------------------------------------------------------------------  
\*\*\* Error: Unable to write to file.  
\*\*\* Reason: Unable to open file “BC.pvd” for writing.  
\*\*\* Where: This error was encountered inside GenericFile.cpp.  
\*\*\* Process: 0

* * *

\*\*\* DOLFIN version: 2019.1.0  
\*\*\* Git changeset: 74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f  
\*\*\* -------------------------------------------------------------------------  
When executing my code, I successfully initialise the problem and subsequently solve it, but this error seems to be related with the creation of my output files in .pvd form:

Output:  
#cells = 18492  
#vertices = 4090  
Setting up MPET problem  
Calling FFC just-in-time (JIT) compiler, this may take some time.  
Calling FFC just-in-time (JIT) compiler, this may take some time.  
Traceback (most recent call last):  
File “[mpm\_2comp\_v0.0.py](http://mpm_2comp_v0.0.py/)”, line 306, in   
single\_run(1, 500, 1.0)  
File “[mpm\_2comp\_v0.0.py](http://mpm_2comp_v0.0.py/)”, line 135, in single\_run  
out\_BC \<\< chi\_v  
File “/usr/local/lib/python3.6/dist-packages/dolfin/io/ **init**.py”, line 14, in **lshift**  
self.write(u.\_cpp\_object)  
RuntimeError:

I have used this code successfully (unaltered) on the previous version of FENICS, without a problem.

Best wishes,

John

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [February 12, 2020, 7:07pm UTC](https://fenicsproject.discourse.group/t/write-pvd-error/2427/2 "2020-02-12T19:07:24Z")

</div>

Can you post the part of code that deals with writing of the `pvd` file? In general,

```auto
with open("<filename>.pvd") as fil:
    fil.write(u)

```

works seamlessly.

---

<div class="post-metadata">

**Author:** ![scsicv](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@scsicv](https://fenicsproject.discourse.group/u/scsicv)\
**Post date:** [February 13, 2020, 9:02pm UTC](https://fenicsproject.discourse.group/t/write-pvd-error/2427/3 "2020-02-13T21:02:59Z")

</div>

Hi Bhavesh,  
I resolved the issue with the following command: sudo chmod 777 -R /home/fenics  
It was a permission issue…  
Best,  
John
