View Issue Details

IDProjectCategoryView StatusLast Update
0004638DraftBugpublic2021-04-21 18:55
Reporterle_top Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.19 
Fixed in Version0.20 
Summary0004638: cannot import name '_ViewProviderDimension' from 'Draft'
DescriptionPlatform: Windows 10
Works with FreeCAD 0.18, not with FreeCAD 0.19 .

FreeCAD 0.19's python reports "cannot import name '_ViewProviderDimension' from 'Draft' " .

Steps To ReproduceCreate two files:

- test.scad:
text ("Hello", halign = "center", valign = "center", size = 6);

- test.py:
#!/usr/bin/python
import FreeCAD
import Part
# This should read any type of file
FreeCAD.loadFile("test.scad")

Then launch (on Windows), using FreeCAD's python:

   "c:\Program Files\FreeCAD 0.19\bin\python.exe" test.py

Compare with FreeCAD 0.18 .

   "c:\Program Files\FreeCAD 0.18\bin\python.exe" test.py
Additional InformationOutput on my machine:

Test using FreeCAD 0.19:

D:\test\openfixture>"c:\Program Files\FreeCAD 0.19\bin\python.exe" test.py
ImportCSG Version 0.6a
Start Lex
End Lex
Load Parser
WARNING: yacc table file version is out of date
WARNING: Token 'DOT' defined, but not used
WARNING: Token 'WORD' defined, but not used
WARNING: There are 2 unused tokens
WARNING: Couldn't create 'parsetab'. [Errno 13] Permission denied: 'C:\\Program Files\\FreeCAD 0.19\\Mod\\OpenSCAD\\parsetab.py'
Parser Loaded
Start Parser
('text', 'Hello')
('size', '6')
('spacing', '1')
('font', '')
('direction', 'ltr')
('language', 'en')
('script', 'Latn')
('halign', 'center')
('valign', 'center')
('$fn', '0')
('$fa', '12')
('$fs', '2')
Traceback (most recent call last):
  File "test.py", line 19, in <module>
    FreeCAD.loadFile("test.scad")
ImportError: Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "C:\Program Files\FreeCAD 0.19\Mod\OpenSCAD\importCSG.py", line 146, in insert
    processcsg(tmpfile)
  File "C:\Program Files\FreeCAD 0.19\Mod\OpenSCAD\importCSG.py", line 177, in processcsg
    result = parser.parse(f.read())
  File "c:\Program Files\FreeCAD 0.19\bin\lib\site-packages\ply\yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "c:\Program Files\FreeCAD 0.19\bin\lib\site-packages\ply\yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "C:\Program Files\FreeCAD 0.19\Mod\OpenSCAD\importCSG.py", line 1167, in p_text_action
    p[0] = [processTextCmd(t)]
  File "C:\Program Files\FreeCAD 0.19\Mod\OpenSCAD\importCSG.py", line 813, in processTextCmd
    face = importDXFface(tmpfilename,None,None)
  File "C:\Program Files\FreeCAD 0.19\Mod\OpenSCAD\OpenSCAD2Dgeom.py", line 480, in importDXFface
    import FreeCAD,importDXF
  File "C:\Program Files\FreeCAD 0.19\Mod\Draft\importDXF.py", line 58, in <module>
    from Draft import _Dimension, _ViewProviderDimension
<class 'ImportError'>: cannot import name '_ViewProviderDimension' from 'Draft' (C:\Program Files\FreeCAD 0.19\Mod\Draft\Draft.py)

cmd


Test using 0.18 (do not mind "list index out of range" - this is related to stripping the original code down to a test case.

D:\test>"c:\Program Files\FreeCAD 0.18\bin\python.exe" test.py
FreeCAD 0.18, Libs: 0.18R16110 (Git)
textmsg : text ( text="Hello", size = 6, spacing = "1", font = "", direction = "ltr", language = "en", script = "Latn", halign = "center", valign = "center", $fn = 0, $fa = 12, $fs = 2);
Geometries in cache: 1
Geometry cache size in bytes: 2048
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Total rendering time: 0:00:00.020
   Top level object is a 2D object:
   Contours: 7

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    FreeCAD.loadFile("test.scad")
OSError: list index out of range

cmd


TagsNo tags attached.
FreeCAD InformationOS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16110 (Git)
Build type: Release
Branch: (HEAD detached at upstream/releases/FreeCAD-0-18)
Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)

Activities

le_top

2021-04-18 11:14

reporter  

test.py (111 bytes)   
#!/usr/bin/python
import FreeCAD
import Part
# This should read any type of file
FreeCAD.loadFile("test.scad")
test.py (111 bytes)   
test.scad (65 bytes)   
text ("Hello", halign = "center", valign = "center", size = 6);
test.scad (65 bytes)   

Kunda1

2021-04-21 18:54

administrator   ~0015636

This has been fixed in the 0.20 development version and should be backported to v0.19.2 (we don't have a date for that release yet).

Closing ticket.

Issue History

Date Modified Username Field Change
2021-04-18 11:14 le_top New Issue
2021-04-18 11:14 le_top File Added: test.py
2021-04-18 11:14 le_top File Added: test.scad
2021-04-21 18:32 Kunda1 Project FreeCAD => Draft
2021-04-21 18:54 Kunda1 Status new => closed
2021-04-21 18:54 Kunda1 Resolution open => fixed
2021-04-21 18:54 Kunda1 Fixed in Version => 0.20
2021-04-21 18:54 Kunda1 Note Added: 0015636
2021-04-21 18:55 Kunda1 Severity block => minor
2021-04-21 18:55 Kunda1 Description Updated
2021-04-21 18:55 Kunda1 Steps to Reproduce Updated
2021-04-21 18:55 Kunda1 Additional Information Updated
2021-04-21 18:55 Kunda1 FreeCAD Information OS: Windows 10 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.16110 (Git) Build type: Release Branch: (HEAD detached at upstream/releases/FreeCAD-0-18) Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40 Python version: 3.6.6 Qt version:... => OS: Windows 10 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.16110 (Git) Build type: Release Branch: (HEAD detached at upstream/releases/FreeCAD-0-18) Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40 Python version: 3.6.6 Qt ...