Stubbed functions documented as covered

34 views
Skip to first unread message

Joshua Stubbs

unread,
Oct 14, 2016, 1:46:16 PM10/14/16
to brython

I recently tried to use chdir and mkdir from os but I couldn't see any visible effect. The standard distributions list has posix and os as supported. After much searching I stumbled across the source code and saw that most of these functions were stubbed.
brython/www/src/Lib/posix.py


Can we really say that it's been ported if it just runs pass?


P.S. I posted this as an issue on Github before I found the group but now I see that this is a better place to ask it.

André

unread,
Oct 15, 2016, 9:06:56 PM10/15/16
to brython


On Friday, 14 October 2016 14:46:16 UTC-3, Joshua Stubbs wrote:

I recently tried to use chdir and mkdir from os but I couldn't see any visible effect. The standard distributions list has posix and os as supported. After much searching I stumbled across the source code and saw that most of these functions were stubbed.
brython/www/src/Lib/posix.py


Can we really say that it's been ported if it just runs pass?


Can you use chdir in Javascript *from within a browser*?  The answer is no, you do not have access to the system files from a script.  Brython cannnot bypass the browser's security.

(note: you can use chdir using node.js - but not from a script running in a browser)

However, in order to run tests without meaningless errors, it might be required for Brython to stub some functions in the standard library; I *suspect* that this is the case.

André

Stu.Axon

unread,
Oct 16, 2016, 12:23:36 PM10/16/16
to brython
There is some sort of file access though isn't there?

So maybe keeping track of a current directory makes sense.

mkdir and anything that writes should probably raise the kind of errors you would expect if you didn't have permission to do those operations.

Joshua Stubbs

unread,
Oct 17, 2016, 8:50:40 AM10/17/16
to brython
Yes. Or even errors that you can't use the function. But the fact that it just does nothing is unnerving.

Dirk Krause

unread,
Nov 24, 2016, 1:18:57 PM11/24/16
to brython
One could implement a virtual file system with localstorage but I guess this means a lot of work and I wonder how many people would use it.
Something like:
https://github.com/filerjs/filer

But, yes, silently passing might not be the best idea.
Reply all
Reply to author
Forward
0 new messages