[Solved] TechDraw template issues? (directory needed write permission access)
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 2
- Joined: Tue Nov 29, 2022 12:45 pm
[Solved] TechDraw template issues? (directory needed write permission access)
Hi there, I hope you can help me? I am using FreeCAD 0.20.1. When in the TechDraw workbench I get the following message when loading the default template or when selecting an alternate template:
"The error message is: Template not set for Page
15:00:18 Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'OSError'>: Cannot copy file from C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg to /A3_LandscapeTD.svg"
However, if I navigate to C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg the A3_LandscapeTD.svg file is there, and I can open it using Google Chrome.
I thank you in advance, Tristan
"The error message is: Template not set for Page
15:00:18 Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'OSError'>: Cannot copy file from C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg to /A3_LandscapeTD.svg"
However, if I navigate to C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg the A3_LandscapeTD.svg file is there, and I can open it using Google Chrome.
I thank you in advance, Tristan
Last edited by Kunda1 on Thu Dec 01, 2022 12:44 pm, edited 1 time in total.
Reason: Added note to title thread
Reason: Added note to title thread
- wandererfan
- Veteran
- Posts: 6321
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: TechDraw template issues?
Not sure why it is trying to write to "/", should be writing to a temporary directory. Do you have write permission for the root directory ("/" on current drive)?TristanGoss wrote: ↑Tue Nov 29, 2022 1:07 pm "The error message is: Template not set for Page
15:00:18 Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'OSError'>: Cannot copy file from C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg to /A3_LandscapeTD.svg"
Re: TechDraw template issues?
Just to add to wandererfan's question, what is the TMP (not TEMP) environment variable set to using:
at a Command Prompt
Code: Select all
set tmp
-
- Posts: 2
- Joined: Tue Nov 29, 2022 12:45 pm
Re: TechDraw template issues?
Thank you, after the IT guys have granted write access the C:\ route directory my problem is solved. Much appreciated!
Re: [Solved] TechDraw template issues? (directory needed write permission access)
I have found the same problem when using freecad 0.21.0 under Windows. From the python console inside freecad I get
But the user can write directly in C:\ outside freecad
Code: Select all
>>> import os
>>> os.getenv('tmp')
'C:\\Users\\fabio\\AppData\\Local\\Temp'
>>> os.getcwd()
'C:\\Program Files\\FreeCAD 0.21\\bin'
>>> os.chdir('/')
>>> os.getcwd()
'C:\\'
>>> f=open('test.free','w')
Traceback (most recent call last):
File "<input>", line 1, in <module>
PermissionError: [Errno 13] Permission denied: 'test.free'
Re: TechDraw template issues?
As you can see from the previous post, it seems that I am not able to write in "/" from freecad but the user has write access to C:wandererfan wrote: ↑Tue Nov 29, 2022 1:28 pmNot sure why it is trying to write to "/", should be writing to a temporary directory. Do you have write permission for the root directory ("/" on current drive)?TristanGoss wrote: ↑Tue Nov 29, 2022 1:07 pm "The error message is: Template not set for Page
15:00:18 Traceback (most recent call last):
File "<string>", line 1, in <module>
<class 'OSError'>: Cannot copy file from C:/Program Files/FreeCAD 0.20/data/Mod/TechDraw/Templates/A3_LandscapeTD.svg to /A3_LandscapeTD.svg"
Re: TechDraw template issues?
On Windows directory permissions have to be managed carefully, you are the user but freecad could result in a different "user" result in the write denial.
There are around if you search as a general problem like "windows directory permissions" ways to check the permissions that could reveal that maybe some permissions are not set correctly.
I'm not a Window expert but the problem is known even in other softwares
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: TechDraw template issues?
I am a Linux user where everything works smoothly Probably there is an issue with permissions but I cannot find a solution. Nothing is written in the docs.onekk wrote: ↑Wed Aug 23, 2023 10:22 pm On Windows directory permissions have to be managed carefully, you are the user but freecad could result in a different "user" result in the write denial.
There are around if you search as a general problem like "windows directory permissions" ways to check the permissions that could reveal that maybe some permissions are not set correctly.
I'm not a Window expert but the problem is known even in other softwares
Regards
Carlo D.
I think the real issue to investigate is why freecad tries to write to "/" instead of
Code: Select all
os.getenv('tmp')
Re: [Solved] TechDraw template issues? (directory needed write permission access)
@wandererfan Thinking out loud here, would it be possible to use FileInfo::getTempFileName rather than QTemporaryFile for the Template temp store, or have you been down this rabbit hole previously?
- wandererfan
- Veteran
- Posts: 6321
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: [Solved] TechDraw template issues? (directory needed write permission access)
AFAIK, the only place TechDraw uses QTemporaryFile is when you press the Export Svg button. From what I can see from the posts, this case doesn't involve Svg Export.
TechDraw does indirectly cause a write to a temporary directory because it uses PropertyFileIncluded for the template file. If PropertyFileIncluded fails to write the temporary file, then the Template would not be created properly, which would cause the "Template not set for Page" message.
I don't think PropertyFileIncluded uses QTemporaryFile, though.