ошибка при компиляции shitil с помощью pyinstaller

Проблема с Pyinstaller и shutil [копирование функции]!

привет, я пытаюсь преобразовать код .py в .exe, на самом деле мой код похож на этот:

 dr  = os.environ['WINDIR']
    current = os.path.abspath(__file__)
    shutil.copy(current, dr)

как мы видим, код копирует текущий штраф в файл Windows (это всего лишь пример); код действительно работает нормально, но если мы скомпилируем его в exe и запустим, мы увидим.

Traceback (most recent call last):
  File "<string>", line 13, in <module>
  File "C:\Documents and Settings\john\Desktop\pyinstaller\pyinstaller-2.0\test
\build\pyi.win32\test\out00-PYZ.pyz\shutil", line 119, in copy
  File "C:\Documents and Settings\john\Desktop\pyinstaller\pyinstaller-2.0\test
\build\pyi.win32\test\out00-PYZ.pyz\shutil", line 82, in copyfile
IOError: [Errno 2] No such file or directory: 'C:\\Documents and Settings\\john
\\Desktop\\pyinstaller\\pyinstaller-2.0\\test\\dist\\test.py'

ошибка связана с копией функции, потому что она не находит test.py в \ test \ dist \ test.py.

любые решения?

Я пытался :

 dr  = os.environ['WINDIR']
    current = os.path.abspath(__file__)
    newfile = current.replace('py','exe')
    shutil.copy(current, dr)

но он все еще говорит

IOError: [Errno 2] No such file or directory: 'C:\\Documents and Settings\\john
\\Desktop\\exeinstaller\\exeinstaller-2.0\\test\\dist\\test.exe'

person user2537958    schedule 01.07.2013    source источник
comment
Может быть полезно: stackoverflow.com/questions/2292703/   -  person Blender    schedule 01.07.2013
comment
спасибо, блендер решил, заменив файл на sys.argv [0]   -  person user2537958    schedule 01.07.2013