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

Error In just the printing statement #12

Closed
inst-cicada opened this issue Dec 17, 2020 · 72 comments
Closed

Error In just the printing statement #12

inst-cicada opened this issue Dec 17, 2020 · 72 comments

Comments

@inst-cicada
Copy link

Expected: StringContaining "[3] find needle in the haystack
[2] water the plants
[1] the thing i need to do
"
Received: "[3] find needle in the haystack·
[2] water the plants·
[1] the thing i need to do·

"

I tried to put \n, different print(), and also tried tripple quoted strings but I dont know from where that (·)dot comes when I test the code with npm test. While testing with my powershell everything is fine with no dots but with npm test there is dots. Please help.

Name: Abhishek Joshi

@harigopal
Copy link
Collaborator

@inst-cicada Could you check for trailing spaces in your output? It's likely that the dot character is being used to indicate additional spaces at the end of the line in your output.

The test doesn't handle additional spaces within the output lines, at the moment.

@rishabh-karmakar
Copy link

The same error persists in my system too. I'm using python and regardless of whatever is done, regex, strip, split, join; nothing works. Removing whitespace, newlines, others, nothing is working.
What is to be done?

@MrAdiii
Copy link

MrAdiii commented Dec 17, 2020

I'm having the same issue, where that (·)dot comes when I test the code with npm test with Python

I'm not a specialist but I think its becz windows uses Windows-1252 and npm tests are converting text to utf-8. on Top of that (again i think) python by default uses system encoder "Windows-1252" on Windows and after python 2.0 there is no easy option to change encoding (or I'm unable to find) so that "\n" (Windows-1252) is converted to (·) utf-8 still not sure

  • and python3 should be replaced with python in todo.bat to make it run on Windows other wise it gives "Python Not Found!"

I tried my code on Ubuntu (linux) and it works without any problem 👍

EDIT:
found a solution for Python on Windows

instead of print(string_variable) try sys.stdout.buffer.write(string_variable.encode('utf8')) and don't forget to import sys to print to console, (where String_variable is ur variable name)

Hope helps :-)

@rishabh-karmakar
Copy link

Yeah, I'll try doing that. Thanks a lot @MrAdiii!

@penanrajput
Copy link

I am using Cpp, can you tell me the solution for dot problem ???

@MrAdiii
Copy link

MrAdiii commented Dec 17, 2020

I am using Cpp, can you tell me the solution for dot problem ???

Try on Linux, running on Ubuntu fix the problem for me in Python

@rishabh-karmakar
Copy link

I am using Cpp, can you tell me the solution for dot problem ???

Yeah @MrAdiii is right, try linux. If you dont have a linux operating sys, try using one with the help of VMWare.

One more workaround discovered was that in python using the print statement with end in no spaces as print(text,end='') also works. Since python by default has end='\n', changing it to '' would help.

@MrAdiii
Copy link

MrAdiii commented Dec 18, 2020

found a solution for Python on Windows

instead of print(string_variable) try sys.stdout.buffer.write(string_variable.encode('utf8')) and don't forget to import sys to print to console, (where String_variable is ur variable name)

thanks to
Saurav Uppoor

@penanrajput
Copy link

penanrajput commented Dec 18, 2020

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code

What's solution of this issue ??

@inst-cicada
Copy link
Author

@inst-cicada Could you check for trailing spaces in your output? It's likely that the dot character is being used to indicate additional spaces at the end of the line in your output.

The test doesn't handle additional spaces within the output lines, at the moment.

I fixed the issue. It took because I was having exams. I encoded it to utf8. It fixed it for me. Thank you.

@inst-cicada
Copy link
Author

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code

What's solution of this issue ??

Solution is to encode the output to 'utf8'. Im not sure for c++ but in python it fixed the issue.

@inst-cicada
Copy link
Author

found a solution for Python on Windows

instead of print(string_variable) try sys.stdout.buffer.write(string_variable.encode('utf8')) and don't forget to import sys to print to console, (where String_variable is ur variable name)

thanks to
Saurav Uppoor

Yes. Sempai. ;-)

@MrAdiii
Copy link

MrAdiii commented Dec 18, 2020

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code

What's solution of this issue ??

https://stackoverflow.com/questions/45575863/how-to-print-utf-8-strings-to-stdcout-on-windows

I haven't tried but, check this

@anshulsinghchouhan4
Copy link

I am facing issues with NPM test, Can any help me out ?
I dont know what is meaning of this error :(

image

@inst-cicada
Copy link
Author

I am facing issues with NPM test, Can any help me out ?
I dont know what is meaning of this error :(

image

Please try to run npm test from the directory where your todo.py and todo.bat files are. Running it in default path won't help you!

@anshulsinghchouhan4
Copy link

Now its showing this ?
Can you tell me, what can I do now ?

image

@inst-cicada
Copy link
Author

Now its showing this ?
Can you tell me, what can I do now ?

image

Before running npm test in your todo.py directory please run npm install -g jest command to install jest and after that you can use npm test . Good Luck @anshulsinghchouhan4

@divyammadhok
Copy link

Hello,
npm test is throwing this error

'D:\Java' is not recognized as an internal or external command,
operable program or batch file.

Everything is working fine on command line, it is npm test which is showing errors. My working folder is in "D:\java"

@Neelam-Nishad
Copy link

Screenshot (38)

Help me please!!
having problem to run todo
it runs fine when I manually type ./todo
but when it was manually opend by test this error occurs " C:\Users\Neelam\OneDrive\Desktop\project\java/todo"
How to fix this??

@Neelam-Nishad
Copy link

Screenshot (39)
Here it works fine when I manually type ./todo

@udaygajavalli
Copy link

Screenshot (38)

Help me please!!
having problem to run todo
it runs fine when I manually type ./todo
but when it was manually opend by test this error occurs " C:\Users\Neelam\OneDrive\Desktop\project\java/todo"
How to fix this??

The issue was with your directory path which contains space in the folder names and child_process package couldn't able to resolve it.
This problem occurred due to the test cases which didn't handled this error.

@udaygajavalli
Copy link

Hello,
npm test is throwing this error

'D:\Java' is not recognized as an internal or external command,
operable program or batch file.

Everything is working fine on command line, it is npm test which is showing errors. My working folder is in "D:\java"

The issue was might be with your directory path which contains space in the folder names and child_process package couldn't able to resolve it in todo.test.js.

@Neelam-Nishad
Copy link

Hello,
npm test is throwing this error
'D:\Java' is not recognized as an internal or external command,
operable program or batch file.
Everything is working fine on command line, it is npm test which is showing errors. My working folder is in "D:\java"

The issue was might be with your directory path which contains space in the folder names and child_process package couldn't able to resolve it in todo.test.js.

export is not for windows maybe , how to change that , because of export command this line is reoccuring
'export' is not recognized as an internal or external command,

@sauravUppoor
Copy link

Help me please!!
having problem to run todo
it runs fine when I manually type ./todo
but when it was manually opend by test this error occurs " C:\Users\Neelam\OneDrive\Desktop\project\java/todo"
How to fix this??

As others said, its due to space in the path name. So here's how you can fix it (it worked for me):
In the todo.test.js, replace the line let todoTxtCli = (...args) => [`${__dirname}/todo`, ...args].join(" "); with this let todoTxtCli = (...args) => [`"${__dirname}"\todo`, ...args].join(" ");

This will tell the cmd that the space encountered is a part of the path and it wont end there. Hope this helps.

@udaygajavalli
Copy link

Help me please!!
having problem to run todo
it runs fine when I manually type ./todo
but when it was manually opend by test this error occurs " C:\Users\Neelam\OneDrive\Desktop\project\java/todo"
How to fix this??

As others said, its due to space in the path name. So here's how you can fix it (it worked for me):
In the todo.test.js, replace the line let todoTxtCli = (...args) => [${__dirname}/todo, ...args].join(" "); with this let todoTxtCli = (...args) => ["${__dirname}"\todo, ...args].join(" ");

This will tell the cmd that the space encountered is a part of the path and it wont end there. Hope this helps.

It works in some cases but didn't work for me.

@anshulsinghchouhan4
Copy link

WHEN I TRY TO RUN IT, IT'S TAKE A LOT OF TIME
Can anyone tell how much time it takes ?

image

@udaygajavalli
Copy link

udaygajavalli commented Dec 20, 2020

WHEN I TRY TO RUN IT, IT'S TAKE A LOT OF TIME
Can anyone tell how much time it takes ?

image

For me, it took around 10 to 20 seconds.

@Neelam-Nishad
Copy link

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code
What's solution of this issue ??

https://stackoverflow.com/questions/45575863/how-to-print-utf-8-strings-to-stdcout-on-windows

I haven't tried but, check this

hey!! can you please help me .. because I assume that my code is correct but still test cases are failing ..
here is the screnshot
Screenshot (47)

@farhaanxxiv
Copy link

farhaanxxiv commented Dec 20, 2020

hey!! can you please help me .. because I assume that my code is correct but still test cases are failing ..
here is the screnshot
Screenshot (47)

Does your cli work when you add/del/done the items? Did you test your app by manually giving arguments?

@ShyamDev12
Copy link

hey!! can you please help me .. because I assume that my code is correct but still test cases are failing ..
here is the screnshot
Screenshot (47)

Does your cli work when you add/del/done the items? Did you test your app by manually giving arguments?

yes bro I am also facing this issue and I tested manually its working fine but the test cases are failing help .

@ShyamDev12
Copy link

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code
What's solution of this issue ??

https://stackoverflow.com/questions/45575863/how-to-print-utf-8-strings-to-stdcout-on-windows
I haven't tried but, check this

hey!! can you please help me .. because I assume that my code is correct but still test cases are failing ..
here is the screnshot
Screenshot (47)

ya same issue here pls help

@abhi5878
Copy link

se I was having

were you using c++, or other language?

If c++, can you tell how you resolved this issue.

@ForgottenProgramme
Copy link

@inst-cicada Could you check for trailing spaces in your output? It's likely that the dot character is being used to indicate additional spaces at the end of the line in your output.

The test doesn't handle additional spaces within the output lines, at the moment.

How to rectify this?

@AkkapelliHarshith
Copy link

I was unable to submit my zip file. Though i was uploading a file with .zip extension , it is giving me error as:
You must upload a ZIP file to submit
Can some help?

@ForgottenProgramme
Copy link

It says 'remove any binary file before uploading'.
Also, should the done.txt and todo.txt files be empty in my zip folder that I want to upload?

@ForgottenProgramme
Copy link

Should I also remove the 'package-lock' folder from my zip folder that I want to upload?
@harigopal

@ForgottenProgramme
Copy link

@MrAdiii

@Balaji-Pa
Copy link

image

Hi why is it throwing error? I am not printing full stops but they are automatically being appended
IN java
I too facing this same issue. Can anyone suggest a solution for this.

@YashwantChauhan
Copy link

image
Hi why is it throwing error? I am not printing full stops but they are automatically being appended
IN java
I too facing this same issue. Can anyone suggest a solution for this.

I think there is no proper answer to this for C++ , either code in pyhton or check in Linux, I struggled with the same problem , I think maybe our cases will pass in their server even when they are not passing for us( because we are using windows which does not uses utf8 encoding ) , just focus on getting the content right and pass the rest of the test parts. Tests can pass in their server because the dot(.) will not be inserted there( I guess );

@chawlajay
Copy link

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code

What's solution of this issue ??

Hey, did you find the solution? what to do to solve this in C++ ?

@chawlajay
Copy link

Expected: StringContaining "[3] find needle in the haystack [2] water the plants [1] the thing i need to do " Received: "[3] find needle in the haystack· [2] water the plants· [1] the thing i need to do·
"

I tried to put \n, different print(), and also tried tripple quoted strings but I dont know from where that (·)dot comes when I test the code with npm test. While testing with my powershell everything is fine with no dots but with npm test there is dots. Please help.

Name: Abhishek Joshi

any solution of this in C++ ?

@udaygajavalli
Copy link

It says 'remove any binary file before uploading'.
Also, should the done.txt and todo.txt files be empty in my zip folder that I want to upload?

Remove the node_modules folder and any binary or hidden files like .vscode or .gitignore

@ankitaYadav02
Copy link

I am unable to uplaod my zip file it says application error at heroku app

@shreedhar37
Copy link

The same error persists in my system too. I'm using python and regardless of whatever is done, regex, strip, split, join; nothing works. Removing whitespace, newlines, others, nothing is working.
What is to be done?

same here

@agmona
Copy link

agmona commented Dec 24, 2020

Uploading IMG20201224181811.jpg…
I got stuck at this point, please help me to resolve this out.

@ultralegendary
Copy link

ultralegendary commented Dec 24, 2020

temp_1
I don't know why i get this error msg while running npm test
`.\todo.out is not recognized as an internal or external command'
Can any one figure out what i am doing wrong?

@rohitpawar2811
Copy link

Screenshot (39)
Here it works fine when I manually type ./todo

can you plzz tel me how would you can run using ./todo because its not working in my system

@ShashiVardhan09
Copy link

todo app took 4-5 hours to code in C++ on Windows 10 blush, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code frowning_face
Here's the screenshot camera_flash : npm test
2020-12-18_10_55_57_Code
What's solution of this issue ??

https://stackoverflow.com/questions/45575863/how-to-print-utf-8-strings-to-stdcout-on-windows
I haven't tried but, check this

hey!! can you please help me .. because I assume that my code is correct but still test cases are failing ..
here is the screnshot
Screenshot (47)

ya same issue here pls help

you need to create a txt file to insert list data

@Khiladi2020
Copy link

Expected: StringContaining "[3] find needle in the haystack [2] water the plants [1] the thing i need to do " Received: "[3] find needle in the haystack· [2] water the plants· [1] the thing i need to do·
"

I tried to put \n, different print(), and also tried tripple quoted strings but I dont know from where that (·)dot comes when I test the code with npm test. While testing with my powershell everything is fine with no dots but with npm test there is dots. Please help.

Name: Abhishek Joshi

everything is working fine on Linux platform this problem is only on windows.
So dont worry if your solution is only failing on those 3 tests

@rohitpawar2811
Copy link

todo app took 4-5 hours to code in C++ on Windows 10 😊, but "\n" is converted to dot(·)
its been 1 day, but couldn't find the solution......
I tried every possible way to encode but couldn't find the solution, and I don't have Linux to test code ☹
Here's the screenshot 📸 : npm test
2020-12-18_10_55_57_Code
What's solution of this issue ??

Hey, did you find the solution? what to do to solve this in C++ ?

hey my first test case which is invisible not solving you have some idea to solve this issue

@rohitpawar2811
Copy link

Screenshot (38)

Help me please!!
having problem to run todo
it runs fine when I manually type ./todo
but when it was manually opend by test this error occurs " C:\Users\Neelam\OneDrive\Desktop\project\java/todo"
How to fix this??

change the todotest.js in which (.) may be not present and add it to there.(./todo)

@Gourav2K
Copy link

I'm unable to understand where exactly am I supposed to have the text files. Because it always throws an error that text file is missing in the directory. When I put the text file manually, after running a test, the files disappear on their own. Would appreciate if someone could help

@Gourav2K
Copy link

Should the text files be present elsewhere and not in the application directory?

@samarthshiramshetty
Copy link

Hey, If someone has completed the app. can you share the source code?

@jasim
Copy link
Collaborator

jasim commented Jan 4, 2021

@samarthshiramshetty Please see the README of the repo:

Kindly desist from sharing your solution privately or publicly. This is because the programming task is not complex for those who've written non-trivial amount of code before. But for beginners, solving this can be quite instructive - frustrating at times, but rewarding in the end.

But if you share your solution with them - through a GitHub repo, or by circulating in your private networks, you're only robbing them of a rewarding experience that would have helped them grow as programmers.

It is trivial to detect copy-cat code submissions and students who submit plagiarized code will be unable to find a place among the limited seats in the course. It is just that it'll take us a few more moments to read through the code and tag it. A lose-lose proposition for all concerned.

@nseadlc-2020 nseadlc-2020 locked as resolved and limited conversation to collaborators Jan 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests