I'm migrating from Matlab to python so i decided to try the pythonxy distribution, but after installation i can't open it. When i double click on icon nothing happens. i already try to submite a issue on pythonxy page but didn't get any answer.
Does anyone knows what this problem could be?
I'm using Win7 x64
this is the traceback information displayed on interactive console:
Traceback (most recent call last):
File "C:\Python27\Scripts\xyhome.pyw", line 21, in <module>
xyhome.main()
File "C:\Python27\lib\site-packages\xy\xyhome.pyw", line 689, in main
form = MainWindow(options)
File "C:\Python27\lib\site-packages\xy\xyhome.pyw", line 134, in __init__
self.scanstartup()
File "C:\Python27\lib\site-packages\xy\xyhome.pyw", line 574, in scanstartup
default_startup()
File "C:\Python27\lib\site-packages\xy\config.py", line 85, in default_startup
filename = osp.join(STARTUP_PATH, CONF.get(None, 'startup'))
File "C:\Python27\lib\ntpath.py", line 109, in join
path += "\\" + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 17: ordinal
not in range(128)
This is a known bug in pythonxy: http://code.google.com/p/pythonxy/issues/detail?id=146
The problem is that your home path contains non-ASCII characters; you would probably have to run it from a user without non-ASCII chars in the home path to make it work for now, while there are patches in the bug report comments, they do not seem to work as intended.
Do you have any non-ascii characters in your path? If so, maybe you would like to change your installation path. It seems that it has a problem with the character "7".
>>> chr(231)
'\xe7'
>>> chr(55)
'7'
My guess is that your 7 in C:\Python27\ is not really a 7.
Related
I'm working on a Python 3.7.9 program (.py) that works perfectly fine when running on both CMD terminal and PyCharm (I am using the reverse_geocoder module - it is relevant to the error). I then used pyinstaller to convert the .py file to .exe. I got the file in the dist folder. But, when running it I get an error:
(I have imported reverse_geocoder as rg -since that pops up in the error)
Traceback (most recent call last):
File "myProgram.py", line 235, in <module>
location = reverseGeocode(coordinates)
File "myProgram.py", line 170, in reverseGeocode
result = rg.search(coordinates)
File "reverse_geocoder\__init__.py", line 292, in search
File "reverse_geocoder\__init__.py", line 88, in getinstance
File "reverse_geocoder\__init__.py", line 111, in __init__
File "reverse_geocoder\__init__.py", line 197, in extract
File "c:\users\USER\appdata\local\programs\python\python37\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 286: character maps to <undefined>
I tried adding encoding='utf-8' to open() in reverse_geocoder_init_.py as suggested by several forum questions, but the error didn't change.
Can somebody help me out? P.S. I'm a beginner in Python so please simplify the answers if possible.
I couldn't solve this. Instead, I decided to use the Bing Reverse geocoder and it solved my issue. That was a lot easier, with smaller code block, and more free API calls per month.
I was trying to get the list of name of txt file that was written in Korean in the specified directory with the code below
dir_list = tf.gfile.Glob(engine.TXT_DIR+"/*.txt")
However, This one gives me the following error:
Traceback (most recent call last):
File "D:/Prj_mayDay/Prj_FrankenShtine/shakespear_reborn/main.py", line 108, in <module>
dir_list = tf.gfile.Glob(engine.TXT_DIR+"/*.txt")
File "D:\KimKanna's Class\python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 326, in get_matching_files
compat.as_bytes(filename), status)
File "D:\KimKanna's Class\python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 325, in <listcomp>
for matching_filename in pywrap_tensorflow.GetMatchingFiles(
File "D:\KimKanna's Class\python35\lib\site-packages\tensorflow\python\util\compat.py", line 106, in as_str_any
return as_str(value)
File "D:\KimKanna's Class\python35\lib\site-packages\tensorflow\python\util\compat.py", line 84, in as_text
return bytes_or_text.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 19: invalid start byte
Now, throughout some research, I found out the reason
The error is because there is some non-ascii character in the dictionary and it can't be encoded/decoded
However, I do not see any way to apply the solution into my code. or is there?
**if there is alternative code for this. It should be applicable for both cloud stroage bucket / my personal hard drive as the code above did.
I'm using python3, Tensorflow version of 1.2.0-rc2
so after few hours of fiddling around with my code I finally found the solution.
Afterall one of the file inside of the directory I specified had a name in Korean. After I took that out of the directory. problem was gone.
I actually have no Idea how to solve this, cause I never used Python before. I just can use Psychopy to generate a script in Python, but I dont find the mistake here. Would be great if you know the answer or you can give me a hint how to find one!:
###################### Running: D:\LTD_Liste1_lastrun.py #######################
pyo version 0.8.5 (uses single precision)
Traceback (most recent call last):
File "D:\LTD_Liste1_lastrun.py", line 77, in <module>
Target = sound.Sound('A', secs=-1)
File "C:\Program Files\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py", line 279, in __init__
init(rate=sampleRate)
File "C:\Program Files\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py", line 128, in init
audioDriver, outputID = _bestDriver(devNames, devIDs)
File "C:\Program Files\PsychoPy2\lib\site-packages\psychopy\sound\backend_pyo.py", line 26, in _bestDriver
preferredDrivers = prefs.general['audioDriver']
File "C:\Program Files\PsychoPy2\lib\site-packages\configobj.py", line 563, in __getitem__
new = [_check(entry) for entry in val]
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 4: invalid continuation byte
This sound like the utf8-encoding bug in the 1.85.3 version that appears mainly on windows 7.
If you try to go to File > Preferences and the same error appears, then it is most likely this bug.
The solution, that worked for me was to uninstall version 1.85.3 and install 1.85.2
Feel free to delete/edit my answer, as soon as this bug is fixed.
you can try to remove 'pyo' from the audio library (Preference -> General) and just keep ['pygame']. It worked for me on Windows 10. I "found" this solution thanks to the comment of #hoechenberger. Huge thanks to her/him.
I'm trying to use aptana studio 3 for a django project, but got a unicodedecodeerror no matter what i did.
After a lot of unsuccessful google searches, tried a barebones django project. Not a line of code from me, just the start code from aptana.
I expected the usual blank page from django (project working, nothing done yet), but STILL got the encode error. I didn't write a single line of code, so there's no template with latin characters or any other encoding/decoding.
Tried:
Windows->Preferences->General->Workspace->Text file encoding to UTF-8
Right click on project ->Resource->Text file encoding to UTF-8
# -- coding: utf-8 -- on first line of every file
Nothing Worked.
I'm kind of stuck here. Can anyone help?
Win7 64bit
Error message from console:
Validating models...
0 errors found
April 02, 2014 - 17:55:34
Django version 1.6, using settings 'hello.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Traceback (most recent call last):
File "C:\Users\bruna\Documents\Aptana Studio 3 Workspace\hello\src\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 285, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 76, in handle
self.run(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 87, in run
self.inner_run(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 132, in inner_run
self.stderr.write("Error: %s" % error_text)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 65, in write
if ending and not msg.endswith(ending):
File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 87: invalid continuation byte
Judging by the stacktrace (the actual place where you should look for the root cause), there's something about msg (most likely, since ending is hardly 87 chars long) in if ending and not msg.endswith(ending): that isn't valid utf-8. This is probably an encoding issue in a settings file or input parameter.
I suggest to:
run the whole thing under PDB to see the value of msg or add a debug printing of repr(msg) before the offending line
track the origin of the incorrect data. It can very well be a developers' oversight (failure to check input data).
You try:
manage.py dbshell
ALTER TABLE database.table MODIFY COLUMN col VARCHAR(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NOT NULL;
Change database.table and col.
Enjoy !
One reason is ,you used sed with grep in the past time like this:
sed -i "s#views_gaoji#fenye#g" grep -rl views_gaoji ./`
The above command will modify .pyc file without notification for you.
Then when you start your Django,
Django will start from .pyc,NOT from your engineering file.
Then you will get error without knowing where the error is
OR
you will get error in your manage.py file but you never modify it,
so why did it say,your manage.py has error?
---------------------------------------------------------------------
That's because you *.pyc file are changed by sed command
Solution:
find . -name "*.pyc" | xargs rm -f
and then type:
python manage.py runserver port
This is one of my own projects. This will later help benefit other people in a game I am playing (AssaultCube). Its purpose is to break down the log file and make it easier for users to read.
I kept getting this issue. Anyone know how to fix this? Currently, I am not planning to write/create the file. I just want this error to be fixed.
The line that triggered the error is a blank line (it stopped on line 66346).
This is what the relevant part of my script looks like:
log = open('/Users/Owner/Desktop/Exodus Logs/DIRTYLOGS/serverlog_20130430_00.15.21.txt', 'r')
for line in log:
and the exception is:
Traceback (most recent call last):
File "C:\Users\Owner\Desktop\Exodus Logs\Log File Translater.py", line 159, in <module>
main()
File "C:\Users\Owner\Desktop\Exodus Logs\Log File Translater.py", line 7, in main
for line in log:
File "C:\Python32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 3074: character maps to <undefined>
Try:
enc = 'utf-8'
log = open('/Users/Owner/Desktop/Exodus Logs/DIRTYLOGS/serverlog_20130430_00.15.21.txt', 'r', encoding=enc)
if it won't work try:
enc = 'utf-16'
log = open('/Users/Owner/Desktop/Exodus Logs/DIRTYLOGS/serverlog_20130430_00.15.21.txt', 'r', encoding=enc)
you could also try it with
enc = 'iso-8859-15'
also try:
enc = 'cp437'
wich is very old but it also has the "ü" at 0x81 wich would fit to the string "üßer" wich I found on the homepage of assault cube.
If all the codings are wrong try to contact some of the guys developing assault cube or as mentioned in a comment: have a look at https://pypi.python.org/pypi/chardet