Giter VIP home page Giter VIP logo

Comments (13)

shalgrim avatar shalgrim commented on May 22, 2024 2

Reading this thread is a weird experience since I'm having a similar but off in important ways experience. I get the "not a valid Win32 application" error when I run it in 32-bit Python, not 64-bit as you seem to.

Unfortunately, when I run things in 64-bit Python I get this:

>>> magic.from_file(r'H:\tmp\1508161', True)
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    magic.from_file(r'H:\tmp\1508161', True)
  File "C:\code_python-magic\python-magic\magic.py", line 131, in from_file
    m = _get_magic_type(mime)
  File "C:\code_python-magic\python-magic\magic.py", line 119, in _get_magic_type
    i = instances.__dict__[mime] = Magic(mime=mime)
  File "C:\code_python-magic\python-magic\magic.py", line 55, in __init__
    self.cookie = magic_open(self.flags)
WindowsError: exception: access violation writing 0x0000000000000001

I should add that I've got those 64-bit cygwin dlls in the system32 folder, renamed, etc.

from python-magic.

ahupp avatar ahupp commented on May 22, 2024

No idea. Maybe you're not allowed to use 32-bit dlls in a 64-bit build of python? Not very familiar with window development.

from python-magic.

nicolargo avatar nicolargo commented on May 22, 2024

Works when i use a 32bit version of Python

from python-magic.

matt-the-bat avatar matt-the-bat commented on May 22, 2024

Same here. On 64-bit CPU. 64-bit python 2.7.3 is a no-go. 32-bit python works.

from python-magic.

kiarashplusplus avatar kiarashplusplus commented on May 22, 2024

so what's the solution for this? I'm using Win 8 and 64-bit python 2.7 and I don't want to just go back to 32-bit Python (my other libraries would fail)

from python-magic.

ahupp avatar ahupp commented on May 22, 2024

Windows does not allow loading 32-bit dlls into a 64-bit process and vice-versa. I've not been able to find any 64-bit builds of libmagic online, so I think you'll need to do your own build of libmagic etc.

from python-magic.

ahupp avatar ahupp commented on May 22, 2024

I've added this to the "Troubleshooting" section of README.md

from python-magic.

SerialPort-zz avatar SerialPort-zz commented on May 22, 2024

Hi,

please: ¿where I can fond file 64 bits?

me too need this DLL, thanks

from python-magic.

rvikmanis avatar rvikmanis commented on May 22, 2024

Resolved this by installing the 64-bit version of Cygwin (http://cygwin.com/install.html) and copying the following list of DLLs from <your-cygwin64-path>\bin to C:\Windows\System32:

  • cygwin1.dll
  • cygz.dll
  • cygmagic-1.dll (Don't forget to rename it to magic1.dll)

from python-magic.

ahupp avatar ahupp commented on May 22, 2024

Awesome, thanks. Rudolfs, would you mind checking the update here to see if it makes sense for cygwin users?

fc73c30

from python-magic.

rvikmanis avatar rvikmanis commented on May 22, 2024

Hi!

I currently don't have the means to test it, but it seems like the update is alright and should work.

On a side note;
If I understand correctly, you started this project back in 2001.
There now appear to be official python bindings for libmagic https://github.com/glensc/file/tree/master/python
(Haven't had the chance to compare, though)

from python-magic.

ahupp avatar ahupp commented on May 22, 2024

This project and those bindings have been in parallel development (neither knowing about the other) for a long time. It's problematic because they share the same module name. I'd like to ultimately merge this in with the file distribution and mark those as deprecated, but haven't gotten around to doing it.

from python-magic.

JesterEE avatar JesterEE commented on May 22, 2024

Thanks @rvikmanis and @ahupp for help with this ... worked for me on Windows 7 x64. Though you don't need to rename the cygmagic-1.dll to magic1.dll anymore due to update fc73c30c2fd4d17babfd1a7b864c96ba517f6130[fc73c30]

from python-magic.

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.