Forums

Error: Implement me. Unknown stream file type

Hi, when I try to execute inside views.py (in Django project) the next line:

analizo = os.popen('jslint --maxerr=100 fich.js').read().split("#")

I get the next error:

Error: Implement me. Unknown stream file type!#012 at createWritableStdioStream (node.js:630:15)#012 at process.stderr (node.js:661:16)#012 at console.js:134:53#012 at NativeModule.compile (node.js:926:5)#012 at Function.NativeModule.require (node.js:895:18)#012 at node.js:205:27#012 at Object.<anonymous> (/usr/lib/node_modules/jslint/lib/nodelint.js:1:73)#012 at Module._compile (module.js:456:26)#012 at Object.Module._extensions..js (module.js:474:10)#012 at Module.load (module.js:356:32)

What I have to do?

Thanks in advance.

Googling that error message (specifically "Error: Implement me. Unknown stream file type!#012 at createWritableStdioStream") gives me a page of things about node.js. I think the error is something that's being returned by jslint itself.

Try running the code from a Bash console and see if you can work out what the underlying JavaScript error is.

I try running the same line analizo = os.popen('jslint --maxerr=100 fich.js').read().split("#") in a bash console and it works correctly. The problems is when I use my app from (adrianvinuelas.pythonanywhere.com). In my views.py this line doesn´t run.

In a bash console the command "jslint" works but not in my views.py.

Perhaps it's getting confused because jslint is expecting to be run from a terminal, not from within another program (technically, it's expecting a PTY rather than a simple stream). What kind of output does it shown when you run it from a console? Is it interactive or using coloured text? If so, you might want to look into using pexpect to run it.

But in local, when I run my app all running correctly.. You can use os.system() or os.popen() to run commands like in the terminal. it's interactive when i run from the console..

os.system and os.popen don't work quite the same as a terminal; they communicate with the running program using simple input and output streams, whereas the terminal use a PTY (pseudo-terminal).

If it works differently on your local machine, perhaps it's a difference in the versions of things that are installed? What kind of computer is your local one? What operating system?

My operating system is Macintosh. You are right! they works differently in the local machine. I use "pexpect" and I fix my problem. But pexpect return bytes then I have to decode the bytes using .decode() and all fine. This is the code if someone get the same problem:

bytesanalizo = pexpect.run("jslint --maxerr=100 fich.js") #bytes

stringanalizo = bytesanalizo.decode() #bytes to string

analizo = stringanalizo.split("#")

Thank you so much!!!

Cool. Glad you got it working.