Bug 117863 - [patch]chinese/pyDict: Fix encode problem, adjust it can run in real console
Summary: [patch]chinese/pyDict: Fix encode problem, adjust it can run in real console
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: chinsan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-06 13:10 UTC by Sunry Chen
Modified: 2007-12-16 20:50 UTC (History)
0 users

See Also:


Attachments
file.diff (2.95 KB, patch)
2007-11-06 13:10 UTC, Sunry Chen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sunry Chen 2007-11-06 13:10:00 UTC
As I mentioned in ports/117388, http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/117388(As I submitted this PR, the ports/117388 can be closed):

Run pydict in console or in X window's xterm, it generates such error:
File "/usr/local/bin/pydict", line 332
SyntaxError: Non-ASCII character '\xa7' in file /usr/local/bin/pydict on line 33
2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for de
tails

This is caused by source encoding problem. After solving this problem, it runs ok in X, but in real console it says:
Traceback (most recent call last):
File "/usr/local/bin/pydict", line 326, in <module>
from gtk import *
File "/usr/local/lib/python2.5/site-packages/gtk-1.2/gtk.py", line 33, in <mod
ule>
_gtk.gtk_init()
RuntimeError: cannot open display

This is because in real console there's no DISPLAY, while the code in line 326 or some others want to initialize the DISPLAY.

Fix: 1. Add source encoding big5 for python source.
2. Adjust python source code, add a judge statement not to import gtk or any other source which affecting running it in real console mode.

Patch attached with submission follows:
How-To-Repeat: Fresh installed chinese/pyDict, run pydict in console, not in X Window's term!
Comment 1 chinsan freebsd_committer freebsd_triage 2007-11-06 13:37:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->chinsan

I'll take it.
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-12-16 20:41:30 UTC
chinsan     2007-12-16 20:41:25 UTC

  FreeBSD ports repository

  Modified files:
    chinese/pyDict       Makefile pkg-descr pkg-plist 
  Added files:
    chinese/pyDict/files patch-dict.py 
  Log:
  - Fix $DISPLAY issue under console environment with python 2.3.
    http://www.python.org/dev/peps/pep-0263/
  - Bump PORTREVISION.
  - Add NOPORTDOCS knob.
  - Pass maintainership to submitter.
  
  PR:             ports/117863
  Submitted by:   Sunry Chen <sunrychen _at_ gmail.com>
  
  Revision  Changes    Path
  1.15      +10 -5     ports/chinese/pyDict/Makefile
  1.1       +50 -0     ports/chinese/pyDict/files/patch-dict.py (new)
  1.4       +2 -0      ports/chinese/pyDict/pkg-descr
  1.2       +4 -4      ports/chinese/pyDict/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 chinsan freebsd_committer freebsd_triage 2007-12-16 20:42:05 UTC
State Changed
From-To: open->closed

Committed with some modification.  Thanks.