{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/1411","labels_url":"https://api.github.com/repos/micropython/micropython/issues/1411/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/1411/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/1411/events","html_url":"https://github.com/micropython/micropython/pull/1411","id":99087570,"number":1411,"title":"unix: Implement 'tell()' method for file class","user":{"login":"blmorris","id":6295715,"avatar_url":"https://avatars.githubusercontent.com/u/6295715?v=3","gravatar_id":"","url":"https://api.github.com/users/blmorris","html_url":"https://github.com/blmorris","followers_url":"https://api.github.com/users/blmorris/followers","following_url":"https://api.github.com/users/blmorris/following{/other_user}","gists_url":"https://api.github.com/users/blmorris/gists{/gist_id}","starred_url":"https://api.github.com/users/blmorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blmorris/subscriptions","organizations_url":"https://api.github.com/users/blmorris/orgs","repos_url":"https://api.github.com/users/blmorris/repos","events_url":"https://api.github.com/users/blmorris/events{/privacy}","received_events_url":"https://api.github.com/users/blmorris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-08-05T00:07:25Z","updated_at":"2015-08-07T08:00:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/micropython/micropython/pulls/1411","html_url":"https://github.com/micropython/micropython/pull/1411","diff_url":"https://github.com/micropython/micropython/pull/1411.diff","patch_url":"https://github.com/micropython/micropython/pull/1411.patch"},"body":"'tell' returns the current position of the read/write pointer on an open file. Already implemented in stmhal.\r\n\r\nWhile trying to use MicroPython to analyze .wav (audio) files using the [wave.py](http://micropython.org/resources/examples/wave.py) and [chunk.py](http://micropython.org/resources/examples/chunk.py) modules from the [AMP audio skin tutorial](http://docs.micropython.org/en/latest/pyboard/tutorial/amp_skin.html) I ran into a difference in behavior between stmhal and unix. On stmhal I could use `setpos()` to read data from anywhere in the file, but this wouldn't work on unix. It turned out that the chunk module uses the presence of the `tell` method to determine whether a file object is 'seekable'. I took the liberty to implement the tell method to fix the issue; please let me know if there is anything that needs to be fixed."},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/128631277","html_url":"https://github.com/micropython/micropython/pull/1411#issuecomment-128631277","issue_url":"https://api.github.com/repos/micropython/micropython/issues/1411","id":128631277,"user":{"login":"dpgeorge","id":6187689,"avatar_url":"https://avatars.githubusercontent.com/u/6187689?v=3","gravatar_id":"","url":"https://api.github.com/users/dpgeorge","html_url":"https://github.com/dpgeorge","followers_url":"https://api.github.com/users/dpgeorge/followers","following_url":"https://api.github.com/users/dpgeorge/following{/other_user}","gists_url":"https://api.github.com/users/dpgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgeorge/subscriptions","organizations_url":"https://api.github.com/users/dpgeorge/orgs","repos_url":"https://api.github.com/users/dpgeorge/repos","events_url":"https://api.github.com/users/dpgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/dpgeorge/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T08:00:39Z","updated_at":"2015-08-07T08:00:39Z","body":"@blmorris: as a hint for the implementation, file.tell() is equivalent to file.seek(0, SEEK_CUR)."}}