UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to <undefined>

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Aug 30 09:25:32 EDT 2018


On Thu, 30 Aug 2018 05:21:30 -0700, pjmclenon wrote:

> my question is ... at the moment i can only run it on windows cmd prompt
> with a multiple line entry as so::
> 
> python createIndex_tfidf.py stopWords.dat testCollection.dat
> testIndex.dat titleIndex.dat
> 
> and then to query and use the newly created index as so:
> 
> python queryIndex_tfidf.py stopWords.dat testIndex.dat titleIndex.dat
> 
> how can i run just one file at a time?

I don't understand the question. You are running one file at a time. 
First you run createIndex_tfidf.py, then you run queryIndex_tfidf.py

Maybe you mean to ask how to combine them both to one call of Python?

(1) Re-write the createIndex_tfidf.py and queryIndex_tfidf.py files to be 
in a single file.

(2) Or, create a third file which runs them both one after another.

That third file doesn't even need to be a Python script. It could be a 
shell script, it would look something like this:


python createIndex_tfidf.py stopWords.dat testCollection.dat 
testIndex.dat titleIndex.dat
python queryIndex_tfidf.py stopWords.dat testIndex.dat titleIndex.dat


and you would then call it from whatever command line shell you use.


> ..or actually link to a front end
> GUI ,so when an question or word or words is input to the input box..it
> can go to the actiona dnrun the above mentioned lines of code

You can't "link to a front end GUI", you have to write a GUI application 
which calls your scripts.

There are many choices: tkinter is provided in the Python standard 
library, but some people prefer wxPython, PyQT4, or other GUI toolkits.

https://duckduckgo.com/?q=python+gui+toolkits



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list