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

MRAB python at mrabarnett.plus.com
Thu Aug 30 13:29:16 EDT 2018


On 2018-08-30 17:57, pjmclenon at gmail.com wrote:
> On Thursday, August 30, 2018 at 9:28:09 AM UTC-4, Steven D'Aprano wrote:
>> 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
> 
> thank you for the reply
> actually your response was pretty much exactly what i am trying to do
> 
> so i will explain what i meant more better
> also i will have to learn shell script cuz i looked it up online and it seems i have to download something and then some other stuff....unless you have  the short steps on how to write a shell script for a win 7 cmd prompt to call 2 or more python scripts
> 
> so what i meant to say in my 1st post is  i have to 1st run the create index program , which i have to run as so:
> 
> python createIndex_tfidf.py stopWords.dat testCollection.dat
> testIndex.dat titleIndex.dat
> 
> i tried b4 a while ago to run the .py file alone but it returns index out of range errors..so thats why i have to run it with the other 4 .dat files
> 
> it takes a few minutes to build the index and then the prompt returns me to the folder im in and
> then i run this:
> 
> python queryIndex_tfidf.py stopWords.dat testIndex.dat titleIndex.dat
> 
> same reason as b4 , i cant run just .py file alone , as it returns index out of range errors
> 
> so that takes another few more minutes and then the cursor keeps blinking and i have to adjust the script some how because i just wait till i can try to input a query at the blinking cursor
> 
> so for example..hello world
> and it will return the titles up to 100, cuz thats the max returns i put in the script
> 
> so thats completetly perfect what you said ..create a 3rd script..a shell script to call the total i beleive its 9 files in total.....but like i said i dont know shell scripting , so i will try to learn it ..hope its not too complicated...or i can make a 3rd python script ...but not sure how to call the 2 python files and 7 .dat files...sorry even though its a year or so i know python..still get lost on import and from and include directives
> 
> 
> as for the GUI ok i will check out your advice..cuz actually i do have a GUI version of this program here..and i wanted to merge them..but its seeming to be complex...i would rather make the GUI for this program cuz its actually exactly as i like it
> thank you for any more explanation on how i can make and run the 3rd merge file script
> 
On Windows you can create a .bat batch file.

Put what you would enter at the command line into a plain textfile and 
give the file the extension ".bat".

Then, to run it, just type the name of the file on the command line.



More information about the Python-list mailing list