3

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)
4
  • Is there more traceback than just the AttributeError? Commented Apr 26, 2015 at 7:46
  • sorry ,col2 is a typo Commented Apr 26, 2015 at 12:37
  • this is complete erorr line: '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' ' Commented Apr 26, 2015 at 12:38
  • 2
    Don't use a comment to add tracebacks/code (since it lacks formatting); instead, just edit your question and add the traceback. Commented Apr 26, 2015 at 17:51

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.