Skip to content

attach command doesn't handle carriage returns correctly #5206

@sagetrac-mhampton

Description

@sagetrac-mhampton

This problem is specific to attaching files ending with ".py" in the notebook. It does not seem to affect the command-line, or files ending with ".sage". Some files that are moved around from different filesystems and editors end up having end-of-line commands that look like: "\r\n". These raise a syntax error when attached. Here is an example (of course you need to change the path):

testfile = file('/home/marshall/Desktop/misc/testrn.py','w')
testfile.write('my_var = 2\r\n')
testfile.close()
attach /home/marshall/Desktop/misc/testrn.py

    Syntax Error:
        attach /home/marshall/Desktop/misc/testrn.py

Component: notebook

Keywords: attach

Issue created by migration from https://trac.sagemath.org/ticket/5206

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions