Coder Social home page Coder Social logo

Comments (11)

mahmoud avatar mahmoud commented on September 28, 2024

Interesting, looks like a Windows file locking issue? I'll have to dust off my Windows machine and give it a closer look. I bet it affects all versions of Windows, but just in case, is this Windows 7 or?

from boltons.

stlehmann avatar stlehmann commented on September 28, 2024

Yes it' s Windows 7...

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

Hey MrLeeh, give it another shot, seems to work great for me on Windows 7 (and Unix).

from boltons.

stlehmann avatar stlehmann commented on September 28, 2024

That is strange. For me it is still not working. Actually I discovered the buck when using the pip-tools library which uses the AtomicSaver.

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

Interesting. Does that mean you're using the pip installed boltons or are you working off the git trunk, or easiest probably, just downloading fileutils.py and importing it?

from boltons.

stlehmann avatar stlehmann commented on September 28, 2024

Currently I' m using the pip install boltons (0.6.5)

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

Ah, yes, the PyPI version hasn't been updated yet. To test the fix just run pip install -e git+https://github.com/mahmoud/boltons.git#egg=boltons and try the fileutils code in question. Or, if you'd like, I can roll out 0.6.6 and you can test that (I did test on Windows 7 earlier today ;) )

from boltons.

stlehmann avatar stlehmann commented on September 28, 2024

Thanks for the link. Now I don' t get this error anymore. But another one:

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from boltons.fileutils import AtomicSaver
>>> with AtomicSaver('foo.txt') as f:
...     f.write('whatever')
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: 'str' does not support the buffer interface

Am I doing something wrong by passing just the String to the write function?

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

Ah, Python 3. You need to encode that string to bytes before writing. f.write('mystring'.encode('utf8')) OR f.write(b'mystring').

from boltons.

stlehmann avatar stlehmann commented on September 28, 2024

Ah, great. That works nice now. I didn' t think about byte encoding. Thank you very much for your help here πŸ‘

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

no problem, enjoy!

from boltons.

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.