Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with TdmsFile(...) as tdms_file: fails to execute #17

Closed
icare4-rapla opened this issue Jun 30, 2014 · 3 comments
Closed

with TdmsFile(...) as tdms_file: fails to execute #17

icare4-rapla opened this issue Jun 30, 2014 · 3 comments

Comments

@icare4-rapla
Copy link

Hi Adam,
Windows 7, Python 3.4, latest npTDMS
Statement:
with TdmsFile(dirpath + "" + datapath) as tdms_file:
Causes @ execution:
AttributeError: exit

@adamreeve
Copy link
Owner

TdmsFile doesn't implement the context manager protocol (ie. the __enter__ and __exit__ methods), so it isn't supposed to be used in a with statement. You should just use:

tdms_file = TdmsFile(dirpath + "\" + datapath)

@icare4-rapla
Copy link
Author

Adam,

Good to now.
How do I close the isssue?

Thanks,

Bob

2014-07-01 3:41 GMT+02:00 Adam Reeve notifications@github.com:

TdmsFile doesn't implement the context manager protocol (ie. the enter
and exit methods), so it isn't supposed to be used in a with
statement. You should just use:

tdms_file = TdmsFile(dirpath + "" + datapath)


Reply to this email directly or view it on GitHub
#17 (comment).

@adamreeve
Copy link
Owner

There should just be a close button on this GitHub issue page, but I can close it.

Cheers,
Adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants