Upload file error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 58-64

瀏覽次數:115 次
跳到第一則未讀訊息

Y Y

未讀,
2014年9月16日 晚上10:46:182014/9/16
收件者:erpnext-dev...@googlegroups.com
As subject. if file name is local language. Please suggest how to fix.

Traceback (innermost last):
File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 47, in uploadfile
ret = frappe.utils.file_manager.upload()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/file_manager.py", line 33, in upload
filedata = save_uploaded(dt, dn)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/file_manager.py", line 52, in save_uploaded
return save_file(fname, content, dt, dn);
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/file_manager.py", line 118, in save_file
fname = get_file_name(fname, content_hash[-6:])
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/file_manager.py", line 254, in get_file_name
if len(n_records) > 0 or os.path.exists(get_files_path(fname)):
File "/home/erpnext/frappe-bench/env/lib/python2.7/genericpath.py", line 18, in exists
os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 58-64: ordinal not in range(128)

Pratik Vyas

未讀,
2014年9月17日 凌晨2:50:052014/9/17
收件者:erpnext-dev...@googlegroups.com
Seems like a bug. Please post the file name.
> --
> Note:
>
> If you are posting an issue,
>
> 1. ERPNext is a free and open source software and support is given on this
> forum by a team (https://frappe.io/webnotes). So please consider donating if
> you find this forum useful (https://frappe.io/buy). Even a small amount
> would be helpful.
> 2. We should be able to replicate it at our end. So please give us as much
> information as you can. Please see it from the point of view of the person
> receiving the communication.
> 3. Paste your code at http://pastebin.com or http://gist.github.com and send
> only the URL via email
> 4. For sending images, use http://imgur.com or other similar services. Do
> not send images as attachments. Links are good. Same goes for any file you
> are going to send.
>
> End of Note
> ---
> You received this message because you are subscribed to the Google Groups
> "ERPNext Developer Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to erpnext-developer...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/erpnext-developer-forum/235fedf5-e614-4e62-b3d8-c8fd3893249e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Pratik
erpnext

Y Y

未讀,
2014年9月17日 凌晨3:34:072014/9/17
收件者:erpnext-dev...@googlegroups.com
新东方名师推荐BEC词汇.doc

above is the file name, it is local file name in chinese.


在 2014年9月17日星期三UTC+8上午10时46分18秒,Y Y写道:

Rushabh Mehta

未讀,
2014年9月18日 凌晨12:48:282014/9/18
收件者:erpnext-dev...@googlegroups.com
That file name works for me too....

I am running Python 2.7.5

@Pratik any clue?



@rushabh_mehta

-- 
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
--- 
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

Pratik Vyas

未讀,
2014年9月18日 凌晨1:14:422014/9/18
收件者:erpnext-dev...@googlegroups.com

Y Y

未讀,
2014年9月18日 凌晨1:31:312014/9/18
收件者:erpnext-dev...@googlegroups.com
mine is 2.7.3, maybe it's time to re-setup from scratch. will update. thanks.

在 2014年9月18日星期四UTC+8下午1时14分42秒,Pratik Vyas写道:
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/erpnext-developer-forum/079433d5-896c-4dde-9a1b-fee98883da9b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Note:
>
> If you are posting an issue,
>
> 1. ERPNext is a free and open source software and support is given on this
> forum by a team (https://frappe.io/webnotes). So please consider donating if
> you find this forum useful (https://frappe.io/buy). Even a small amount
> would be helpful.
> 2. We should be able to replicate it at our end. So please give us as much
> information as you can. Please see it from the point of view of the person
> receiving the communication.
> 3. Paste your code at http://pastebin.com or http://gist.github.com and send
> only the URL via email
> 4. For sending images, use http://imgur.com or other similar services. Do
> not send images as attachments. Links are good. Same goes for any file you
> are going to send.
>
> End of Note
> ---
> You received this message because you are subscribed to the Google Groups
> "ERPNext Developer Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Pratik Vyas

未讀,
2014年9月18日 清晨5:50:522014/9/18
收件者:erpnext-dev...@googlegroups.com
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/file_manager.py",
line 254, in get_file_name
if len(n_records) > 0 or os.path.exists(get_files_path(fname))

Can you try changing that line to

if len(n_records) > 0 or os.path.exists(get_files_path(fname.encode('utf-8')))
>> > email to erpnext-developer...@googlegroups.com.
>> > email to erpnext-developer...@googlegroups.com.
> --
> Note:
>
> If you are posting an issue,
>
> 1. ERPNext is a free and open source software and support is given on this
> forum by a team (https://frappe.io/webnotes). So please consider donating if
> you find this forum useful (https://frappe.io/buy). Even a small amount
> would be helpful.
> 2. We should be able to replicate it at our end. So please give us as much
> information as you can. Please see it from the point of view of the person
> receiving the communication.
> 3. Paste your code at http://pastebin.com or http://gist.github.com and send
> only the URL via email
> 4. For sending images, use http://imgur.com or other similar services. Do
> not send images as attachments. Links are good. Same goes for any file you
> are going to send.
>
> End of Note
> ---
> You received this message because you are subscribed to the Google Groups
> "ERPNext Developer Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to erpnext-developer...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/erpnext-developer-forum/d38ada52-728f-4d97-afef-0de5217719c5%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Pratik
erpnext

Pratik Vyas

未讀,
2014年9月18日 清晨5:54:292014/9/18
收件者:erpnext-dev...@googlegroups.com
Sorry, I meant whatever Anand is saying here,
https://github.com/frappe/frappe/issues/847#issuecomment-55999093
--
Pratik
erpnext

Y Y

未讀,
2014年9月18日 清晨6:33:452014/9/18
收件者:erpnext-dev...@googlegroups.com
Tried, not work at my side, anyway, i think we will setup from scratch and try. Thanks very much.

在 2014年9月18日星期四UTC+8下午5时54分29秒,Pratik Vyas写道:

Y Y

未讀,
2014年9月18日 清晨6:37:472014/9/18
收件者:erpnext-dev...@googlegroups.com
Tried, not work at my side, anyway, i think we will setup from scratch and try. Thanks very much.

在 2014年9月18日星期四UTC+8下午5时54分29秒,Pratik Vyas写道:
Sorry, I meant whatever Anand is saying here,

Y Y

未讀,
2014年9月22日 凌晨4:49:562014/9/22
收件者:erpnext-dev...@googlegroups.com
Dear Team,

In my VM, i enter into python console, then show sys.getdefaultencoding(), result is: ascii

I think that's the issue. why would happens to that, i used same installation setup(via bench).

any simple solution for this?

Thanks,
Yang

在 2014年9月17日星期三UTC+8上午10时46分18秒,Y Y写道:

Anand Doshi

未讀,
2014年9月22日 上午9:37:012014/9/22
收件者:erpnext-dev...@googlegroups.com
It is supposed to be ascii by default and it should still work like in my system. Is your bench folder name or some other folder in hierarchy contain non English names?

-Anand 
--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues

---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/27829800-d656-44c3-91d5-23345d9a8d97%40googlegroups.com.

Y Y

未讀,
2014年9月22日 上午10:31:422014/9/22
收件者:erpnext-dev...@googlegroups.com
I fixed that..., It shall be get_files_path(fname).encode('utf-8') haha...

在 2014年9月22日星期一UTC+8下午9时37分01秒,Anand Doshi写道:
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

未讀,
2014年9月22日 上午11:15:322014/9/22
收件者:erpnext-dev...@googlegroups.com
Pull request please 😀

Sent from my phone
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f75736ad-8652-4e1f-aed9-b5e6f31d89de%40googlegroups.com.

Y Y

未讀,
2014年9月22日 晚上8:30:122014/9/22
收件者:erpnext-dev...@googlegroups.com
Against 4 or 5?

在 2014年9月22日星期一UTC+8下午11时15分32秒,Anand Doshi写道:

Rushabh Mehta

未讀,
2014年9月22日 晚上11:39:382014/9/22
收件者:erpnext-dev...@googlegroups.com
4 is okay for this.

@rushabh_mehta
via mobile
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/298f1bb8-693b-43a8-a95f-4d48fbb0b114%40googlegroups.com.
回覆所有人
回覆作者
轉寄
0 則新訊息