MSepehr
MSepehr

Reputation: 970

AttributeError: 'module' object has no attribute 'BuiltinFunctionType' in pycharm

i write a code in python language which uses copy module. when i run this code in pycharm console it has no error but in pycharm GUI environment it gives me this error:

Traceback (most recent call last): 
    File "C:/....../python/deepshallowcopy.py", line 2, in <module> 
        from copy mport deepcopy 
    File "C:\Python34\lib\copy.py", line 114, in <module>
        types.BuiltinFunctionType, type(Ellipsis),
AttributeError: 'module' object has no attribute 'BuiltinFunctionType'

My code is:

from copy import deepcopy
col3=["rrrr","bbbb"]
col4=deepcopy(col3)
print(col3,col4)
col3[0]="jfjdhf"
print(col3,col4)

Upvotes: 3

Views: 2759

Answers (1)

Luke Woodward
Luke Woodward

Reputation: 64959

Taking a closer look at your traceback,

Traceback (most recent call last):
  File "C:/....../python/deepshallowcopy.py", line 2, in <module>
    from copy import deepcopy
  File "C:\Python34\lib\copy.py", line 114, in <module>
    types.BuiltinFunctionType, type(Ellipsis),
AttributeError: 'module' object has no attribute 'BuiltinFunctionType'

you must have a Python file named types.py in the same folder that you are running your deepshallowcopy.py file.

I was able to reproduce this error by running your script in the same folder as a file named types.py.

Upvotes: 8

Related Questions