Skip to content

Commit

Permalink
Avoid windows non-ascii string path bug
Browse files Browse the repository at this point in the history
Its a tough works to solve the non-ascii string path problem about
python 2.x and python 3.x both on Windows and Linux,so users better to
give up using non-ascii string path on Windows platform
  • Loading branch information
LandGrey committed Apr 13, 2017
1 parent 9bf3c18 commit 71c9ad3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
startime = time.time()

# project root path
root_path = (os.path.join(os.path.dirname(os.path.abspath(sys.argv[0]))).encode('utf-8').decode()
if int(platform.python_version()[0]) >= 3
else unicode(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0]))), 'utf-8'))

try:
root_path = (os.path.join(os.path.dirname(os.path.abspath(sys.argv[0]))).encode('utf-8').decode()
if int(platform.python_version()[0]) >= 3
else unicode(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0]))), 'utf-8'))
except:
exit("\n[-] Please ensure pydictor root path is ascii strings!")
# ---------------------------------- you can modify it ----------------------------------

# output file prefix
Expand Down

0 comments on commit 71c9ad3

Please sign in to comment.