Code Monkey home page Code Monkey logo

Comments (7)

peter-wangxu avatar peter-wangxu commented on June 18, 2024

py27 was passed on CI: https://ci.appveyor.com/project/peter-wangxu/persist-queue/builds/19169922

what's the type of src and dst?

from persist-queue.

Murray-LIANG avatar Murray-LIANG commented on June 18, 2024
src = 'c:\\users\\liangr\\appdata\\local\\temp\\tmpol0feq'
dst = 'c:\users\liangr\appdata\local\temp\tmpsulfcsstorops\info'

('type(src)', <type 'str'>)
('type(dst)', <type 'unicode'>)
('isinstance(src, _str)', False)
('isinstance(dst, _str)', True)
('isinstance(src, _bytes)', True)
('isinstance(dst, _bytes)', False)

from persist-queue.

Murray-LIANG avatar Murray-LIANG commented on June 18, 2024

Most of storops python source files set from __future__ import unicode_literals. This would make any string literal to be unicode.

In TestPQueue of storops,

from __future__ import unicode_literals
# ... ...
self.path = tempfile.mkdtemp(suffix='storops')
self.q = tasks.PQueue(self.path)

And this would make _infopath in Persist-Queue and dst of atomic_rename to be unicode.

While in Persist-Queue, unicode_literals is not imported. And src of atomic_rename is returned by tempfile.mkstemp(), so it is str.

That is the reason what we got as the above comments.
src is str, dst is unicode.

So the conclusion is that any source codes with unicode_literals imported could meet this issue.

Can we convert the type of src or dst to make them as the same type first?

from persist-queue.

peter-wangxu avatar peter-wangxu commented on June 18, 2024

@Murray-LIANG loooooking forward to your change:)

from persist-queue.

Murray-LIANG avatar Murray-LIANG commented on June 18, 2024

Sorry for the late response. I will do the fix next days. My proposal is that converting the src and dst to str or unicode first regardless of their original types.

What I don't understand is that why it chooses different ctypes move functions based on the type of file paths?

from persist-queue.

peter-wangxu avatar peter-wangxu commented on June 18, 2024

AFAIK, this is the windows API limitation, MoveFileExW for unicode MoveFileExA for ascii only.
Agreed with you to convert, and we can use the former function for both str or unicode.

from persist-queue.

peter-wangxu avatar peter-wangxu commented on June 18, 2024

@Murray-LIANG any update?

from persist-queue.

Related Issues (20)

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.