Git Product home page Git Product logo

python-descript-ion's People

Contributors

histrio avatar lowks avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-descript-ion's Issues

copying temp file fails in ion.py

Я использую:
I use:

  • Windows 8.1 x64
  • Python 3.8.1
  • Far Manager 3.0.5596 x64 (as user or as Administrator - no matter)

Вот файл test.py, который падает с ошибкой:
Here is the file test.py that fails:

import descript.ion
with descript.ion.open('.\\test.py') as f:
    f.description = 'Description 1'
# Файл 'descript.ion' создался и содержит описание test.py
# File 'descript.ion' created; it contains the description of test.py
with descript.ion.open('.\\test.py') as f:
    f.description = 'Description 2'
# Traceback (most recent call last):
#   File "D:\V\Programs\Python\description\test.py", line 8, in <module>
#     f.description = 'Description 2'
#   File "C:\Program Files\Python\lib\site-packages\descript\ion.py", line 97, in __set__
#     self[obj.name] = val
#   File "C:\Program Files\Python\lib\site-packages\descript\ion.py", line 87, in __setitem__
#     del self[key]
#   File "C:\Program Files\Python\lib\site-packages\descript\ion.py", line 91, in __delitem__
#     delete_key(key)
#   File "C:\Program Files\Python\lib\site-packages\descript\ion.py", line 42, in wrapper
#     return clbl(dfile, key, *args, **kwargs)
#   File "C:\Program Files\Python\lib\site-packages\descript\ion.py", line 60, in delete_key
#     copyfile(dst.name, dfile)
#   File "C:\Program Files\Python\lib\shutil.py", line 259, in copyfile
#     with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
# PermissionError: [Errno 13] Permission denied: 'C:\\TEMP\\tmp_o6x646l'

Для отладки я добавил строку в ion.py:
I added debug line into ion.py:

        input("Temporary file: "+dst.name)
        # Здесь я проверил, что временный файл существует и доступен для чтения
        # Here I checked that the temporary file exists and is readable
        copyfile(dst.name, dfile)

Возможно, проблема в этом:
This may be the reason of the problem:
https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile:

Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

Возможные изменения в функции delete_key(dfile, key)
Possible changes in function delete_key(dfile, key):

    ...
    dst = tempfile.NamedTemporaryFile('w+', delete = False)
    with native_open(dfile, 'r') as src:
        ...
    dst.close()
    copyfile(dst.name, dfile)
    os.remove(dst.name)
    ...

garbage files in the pypi repository

It's not a big problem, but I believe that git conflict file descript/ion.py.orig was submitted to the pypi repository by mistake:

# pip3 show -f descript
Name: descript
Version: 0.1.1
Summary: Simple library for `descript.ion` files manipulation.
Home-page: https://github.com/histrio/python-descript-ion
Author: Rinat Sabitov
Author-email: [email protected]
License: Apache-2.0
Location: /usr/local/lib/python3.7/dist-packages
Requires: 
Required-by: 
Files:
  descript-0.1.1.dist-info/INSTALLER
  descript-0.1.1.dist-info/LICENSE.md
  descript-0.1.1.dist-info/METADATA
  descript-0.1.1.dist-info/RECORD
  descript-0.1.1.dist-info/WHEEL
  descript/__init__.py
  descript/__pycache__/__init__.cpython-37.pyc
  descript/__pycache__/ion.cpython-37.pyc
  descript/ion.py
  descript/ion.py.orig

path in descript.ion filenames

When filename with path used in descript.ion.open, the path is stored in descript.ion file. It should not! And vice versa, when reading description using filename with path, the procedure does not read descriptions of filenames which were stored without path.

does not install the module itself when installed from pip

When installed using pip, only metadata are installed, no module code:

$ pip3 show -f descript
Name: descript
Version: 0.0.1
Summary: UNKNOWN
Home-page: https://github.com/histrio/python-descript-ion
Author: Rinat F Sabitov
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.7/dist-packages
Requires: 
Required-by: 
Files:
  descript-0.0.1.dist-info/INSTALLER
  descript-0.0.1.dist-info/METADATA
  descript-0.0.1.dist-info/RECORD
  descript-0.0.1.dist-info/WHEEL
  descript-0.0.1.dist-info/top_level.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.