{solved} Path preferences error: "AttributeError: 'NoneType' object has no attribute 'FileName'"

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
spanner888
Posts: 326
Joined: Tue May 28, 2019 10:51 am

{solved} Path preferences error: "AttributeError: 'NoneType' object has no attribute 'FileName'"

Post by spanner888 »

Just updated to latest AppImage

Code: Select all

OS: Debian GNU/Linux 10 (buster) (XFCE/xfce)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23463 (Git) AppImage
Build type: Release
Branch: master
Hash: adc6db8f32c17e9f67cb82aa7962d1e42ce061c6
Python version: 3.8.6
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Australia (en_AU)
Deleted ~/.FreeCAD and while setting my preferences, I keep getting error shown. However I have not been able to track down a repeatable way to trigger the error. Initially it seemed to happen after some delay...but not always. At other times when I set a particular path setting, but it now seems that was coincidence.

Today
deleted ~/.FreeCAD
Opened FC & Path WB
Selected: General - Units - Metric small parts
Opened, but no changes to: Path - Post Processor, then the error occurred:

Code: Select all

10:29:19  Traceback (most recent call last):
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 271, in setProcessorListTooltip
10:29:19      self.setPostProcessorTooltip(self.form.postProcessorList, item.text(), '')
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 264, in setPostProcessorTooltip
10:29:19      processor = self.getPostProcessor(name)
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 258, in getPostProcessor
10:29:19      processor = PostProcessor.load(name)
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPostProcessor.py", line 47, in load
10:29:19      exec("import %s as current_post" % postname, namespace) # pylint: disable=exec-used
10:29:19    File "<string>", line 1, in <module>
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/post/nccad_post.py", line 70, in <module>
10:29:19      '''.format(__name__, App.ActiveDocument.FileName, str(datetime.datetime.now()))
10:29:19  AttributeError: 'NoneType' object has no attribute 'FileName'
10:29:19  Traceback (most recent call last):
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 271, in setProcessorListTooltip
10:29:19      self.setPostProcessorTooltip(self.form.postProcessorList, item.text(), '')
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 264, in setPostProcessorTooltip
10:29:19      processor = self.getPostProcessor(name)
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 258, in getPostProcessor
10:29:19      processor = PostProcessor.load(name)
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPostProcessor.py", line 47, in load
10:29:19      exec("import %s as current_post" % postname, namespace) # pylint: disable=exec-used
10:29:19    File "<string>", line 1, in <module>
10:29:19    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/post/centroid_post.py", line 84, in <module>
10:29:19      '''.format(__name__, FreeCAD.ActiveDocument.FileName, str(now))
10:29:20  AttributeError: 'NoneType' object has no attribute 'FileName'
10:29:35  Traceback (most recent call last):
10:29:35    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 271, in setProcessorListTooltip
10:29:35      self.setPostProcessorTooltip(self.form.postProcessorList, item.text(), '')
10:29:35    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 264, in setPostProcessorTooltip
10:29:35      processor = self.getPostProcessor(name)
10:29:35    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPreferencesPathJob.py", line 258, in getPostProcessor
10:29:35      processor = PostProcessor.load(name)
10:29:35    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/PathPostProcessor.py", line 47, in load
10:29:35      exec("import %s as current_post" % postname, namespace) # pylint: disable=exec-used
10:29:35    File "<string>", line 1, in <module>
10:29:35    File "/tmp/.mount_FreeCASl9Xx6/usr/Mod/Path/PathScripts/post/centroid_post.py", line 84, in <module>
10:29:35      '''.format(__name__, FreeCAD.ActiveDocument.FileName, str(now))
10:29:35  AttributeError: 'NoneType' object has no attribute 'FileName'
Searching shows this general type of error is has been fairly common over the years in FreeCAD, but I cannot see anything specific to this message of Path WB.

Anyone have any ideas about this?

EDIT: Marked as solved, as no other reports, long time elapsed, release of FC .20 and advice below.
Last edited by spanner888 on Mon Aug 08, 2022 9:14 pm, edited 1 time in total.
malcomjarr
Posts: 1
Joined: Mon Aug 08, 2022 7:21 am

Re: Path preferences error: "AttributeError: 'NoneType' object has no attribute 'FileName'"

Post by malcomjarr »

AttributeError means that there was an Error that had to do with an Attribute request. In general, when you write x.y, y is the purported attribute of x. NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. That usually means that an assignment or function call up failed or returned an unexpected result.

mylist = mylist.sort()

The sort() method of Python list sorts the list in-place, that is, mylist is modified. But the actual return value of the method is None and not the list sorted. So you've just assigned None to mylist. If you next try to do, say, mylist.append(1) Python will give you this error.
Last edited by Roy_043 on Wed Dec 27, 2023 1:34 pm, edited 1 time in total.
Reason: Removed spam link
spanner888
Posts: 326
Joined: Tue May 28, 2019 10:51 am

Re: Path preferences error: "AttributeError: 'NoneType' object has no attribute 'FileName'"

Post by spanner888 »

thanks for the information, will keep that in mind while I code.

Regarding reported issue, I had forgotten all about it as it has no longer been ocurring for me, so will mark this as solved, given the length of time and release of 0.20.
Post Reply