
나는 Google 코드에 게시된 소스에서 cpconverter
완전히 새로운 데비안 패키지를 만들고 있습니다.A simple utility to change the code page of plain text based files
모든 것이 잘 진행되었습니다. 그러나 작동하는 런치패드 런처를 얻을 수 없습니다.
Python 파일은 cpConverter.py
폴더에 저장됩니다 /usr/share/cpconverter/cpconverter/
.
폴더에 다음과 같은 Shell Script
이름이 있습니다 .cpconverter
/usr/bin/
#!/bin/sh
python /usr/share/cpconverter/cpconverter/cpConverter.py
데스크탑 런처는 cpconverter.desktop
간단합니다
[Desktop Entry]
Version=0.5
Encoding=UTF-8
Name=Code Page Converter
Name[en_US]=Code Page Converter
Comment=A simple utility to change the code page of plain text based files
Type=Application
Exec=/usr/bin/cpconverter
Icon=cpconverter
Terminal=false
StartupNotify=true
Categories=Utility;
그러나 시작되지 않습니다.
cpConverter.py
설치된 프로그램을 실행하여 제대로 작동하는지 확인했습니다 .
$ python /usr/share/cpconverter/cpconverter/cpConverter.py
그런 다음 프로그램이 어떤 경우에 시작됩니다. 런처를 클릭한 후 더 이상 작동하지 않는 경우가 많습니다.
cpConverter.py
그러나 패키지의 건물 구조에 있는 파일은 항상 작동합니다.
$ python cpconverter-0.5/debian/cpconverter/usr/share/cpconverter/cpconverter/cpConverter.py
터미널에서 동일한 명령줄을 입력하려고 했는데 (적어도 나에게는) 들어본 적 없는 다양한 오류가 발생했습니다.
$ cpconverter
/usr/bin/cpconverter: 3: /usr/bin/cpconverter: pyhton: not found
$
$ pyhton /usr/share/cpconverter/cpconverter/cpConverter.py
No command 'pyhton' found, did you mean:
Command 'python' from package 'python-minimal' (main)
pyhton: command not found
$
convertall
그런 다음 패키지 사용 에 대한 실제 예제를 시도했습니다 Shell Script
.
#!/bin/sh
exec /usr/bin/python3 /usr/share/convertall/convertall.py "$@"
터미널에서 다음을 사용하여 성공적으로 시작할 수 있습니다.
$ python3 /usr/share/convertall/convertall.py "$@"
Shell Script
그런 다음 다음 내용에 따라 수정했습니다 .
exec /usr/bin/python2 /usr/share/cpconverter/cpConverter.py "$@"
그 결과 여전히 Desktop Launcher가 작동하지 않습니다. 일부 모래시계만 있고 아무것도 작동하지 않습니다. 그러나 다음 세 가지 명령줄 중 하나는 항상 프로그램을 시작합니다.
$ python2 /usr/share/cpconverter/cpconverter/cpConverter.py "$@"
$ /usr/bin/cpconverter
$ cpconverter
에 대한 액세스 권한은 cpconverter.desktop
표준입니다.
$ ls -l /usr/share/applications/clipgrab.desktop
-rw-r--r-- 1 root root 626 Dec 9 2014 /usr/share/applications/clipgrab.desktop
그러면 Desktop Launcher가 프로그램을 시작할 수 없는 이유는 무엇입니까? 데스크탑 런처에 어떤 문제가 있나요? [위에서 확인하세요]
답변1
이것이 정말로 필요한지는 잘 모르겠지만 bash 스크립트를 만들 때 "bash $$$$$$$.sh" 명령을 사용하여 스크립트를 시작했습니다. 제가 이것을 언급하는 유일한 이유는 데스크탑 런처의 스크립트 이름에 .py 확장자가 없기 때문입니다. 아무것도 아닐 수도 있습니다. 살펴보고 시도해 볼 가치가 있습니다. 크레이그
답변2
글쎄, 내가 코멘트에서 말했듯 이 데스크톱 런처가 수행하는 것처럼 디렉터리 Dash Script
에서 실행하면 다음 Python 오류로 인해 실패했습니다./usr/bin/
/usr/bin$ cpconverter
Traceback (most recent call last):
File "/usr/share/cpconverter/cpconverter/cpConverter.py", line 342, in <module>
app = cpConverter()
File "/usr/share/cpconverter/cpconverter/cpConverter.py", line 74, in __init__
builder.add_from_file("./gui/gui.xml")
glib.GError: Failed to open file './gui/gui.xml': No such file or directory
$
cpconverter
홈 폴더나 (coCPnverter.py 파일이 있는) 다른 곳에서 프롬프트를 실행하면 /usr/share/cpconverter/cpconverter
성공할 것입니다.
./
그렇다면 범인이 파일 에 있다는 것이 분명해졌습니다 cpConverter.py
.
allow-launch-from-usr-bin-script.patch
저는 단순히 상대 경로 대신 절대 경로(패키징된 경우)를 배치하는 패치를 만들었습니다 .
builder.add_from_file("/usr/share/cpconverter/cpconverter/gui/gui.xml")
문제를 설명하고 해결했습니다.