I'm working on an EXE file crypter in python 3.11.1 and I cannot seem to get the System.Reflection import working. I've tried pythonnet and clr, but it just doesn't recognize 'System.'
I've tried to make sure pythonnet and clr are not conflicting, but that hasn't worked either. I tried clearing the cache and reinstalling python entirely. I also made sure there weren't any multiple instances of pip and python. This is the code snippet:
def crypt(filepath):
import base64
import clr
from System.Reflection import Assembly
Related
I am using Pillow-6.1.0 for my python project and I am trying to import the ImageGrab() function inside it however I keep getting this following error:
cannot import name '_imaging' from 'PIL'
I am currently using Python 3.7 and editing the code on Visual Studios (Unsure if the IDE may play part in the error as I do not have much experience on it)
I am also running Windows so some of the solutions I have seen which require Linux does not work for me.
What I have tried:
Uninstalling and reinstalling Pillow
Deleting everything with "PIL" in the Python37-32/Lib/site-packages folder and uninstalling Pillow and reinstalling
Moving the Pillow module directly into my project folder
Moving ImageGrab.py directly into my project folder
Updated my Pillow module
All my reinstallations of Pillow is via the pip command
Other possibly relevant info:
ImageGrab() is not the only module that I cant import, I also cant import the Image module
I can import the PIL module successfully but I cannot access the modules within it via the command "from PIL import some_PIL_module" in my IDE
I only get the "cannot import name '_imaging' from 'PIL'" error when I am running my code through the Visual Studios IDE, if I type the command "from PIL import ImageGrab" directly into the python terminal it runs successfully with no errors
This is the line that gives me the error in my code
from PIL import ImageGrab;
I expected it to import with no problems but instead, I get the following error:
cannot import name '_imaging' from 'PIL'
I’m new to Python and programming in general.
I am trying to install pdfMiner. I have Windows 7 with Python 2.7 installed.
I followed the instructions when installing (downloaded the PDFMiner source, unpacked it, and ran setup.py to install and it was installed in C:\pdfminer) – no errors.
It created:
build, build\lib,build\lib\pdfminer, then copied files to build\lib\pdfminer. It created build\scripts-2.7 and copied tools\pdf2txt.py, dymppdf.py to scripts, then wrote install-egg-info
and had no errors with install.
When I try running the test document from the command line:
C:\pdfminer\pdfminer-20140328> pdf2txt.py samples/simple1.pdf
I get:
File “C:\Python27\Scripts\pdf2txt.py”, line3, in <module> from pdfminer.pdfdocument import PDFDocument
ImportError: No module named pdfminer.pdfdocument
I saw this post:
pdfminer - ImportError: No module named pdfminer.pdfdocument
and tried following it (#1..put sys.path.append… into pdf2txt.py) and get the same error.
The system variables do include the path (pdfminer\pdfminer-20140328).
I’ve looked for other solutions but haven’t had much luck – the file is there but I can’t seem to get the program to look in the right area for it…I think.
Do I have the wrong path or is it installed in the wrong directory?
I'm using Python 3.3.5 with cx-freeze 4.3.3 on windows 8.1.
I'm trying to cx_freeze a program that uses pkg_resources.
I initially had it in my setup file under packages, but when I tried to freeze it the processes stopped with an error Import Error: No module named 'pkg_resources'.
I then moved it in the setup file from packages to includes. The cx_freeze process completed this time but when I tried to start the application I got another error message.
If I go to my IDE and try to import pkg_resources it works fine.
>>> import pkg_resources
>>> pkg_resources
<module 'pkg_resources' from 'C:\\Python33\\lib\\site-packages\\setuptools-18.0.1-py3.3.egg\\pkg_resources\\__init__.py'>
There's a similar question asked here, and the solution is to re-install setuptools. So I downloaded setuptools 18.0.1 and installed it via cmd, but it did not solve my problem and I'm still getting the same errors with cx_freeze.
Any help getting this to work would be greatly appreciated.
Edit: My solution (hack) has been to write the dependency out of yagmail. Yagmail's original _innit__.py...
from pkg_resources import get_distribution
__project__ = 'yagmail'
__version__ = get_distribution(__project__).version
I first put a print statement in there to get the version, and then hard coded it.
__project__ = 'yagmail'
__version__ = '0.4.84'
Though this has solved my problem it isn't really the answer, so will leave this open should someone have a solution that keeps pkg_resources.
First the setup: Windows 8.1 64bit, Python 3.4 32bit.
I wanted to run the code here. So I installed comtypes
pip install comtypes
I then tried to run the code, i got
ImportError: cannot import name 'SpeechLib'
Then tried this code here to try and generate the needed SpeechLib module.
I am however still getting the same error, what should I try next?
Running these lines made it work:
from comtypes.client import CreateObject
engine = CreateObject("SAPI.SpVoice")
stream = CreateObject("SAPI.SpFileStream")
Output was:
# Generating comtypes.gen._C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4
# Generating comtypes.gen.SpeechLib
After this I got no import error anymore, as expected.
I tried to install VIM-Latex using the Pathogen plugin on my machine which is running OSX Lion 10.7.5. I copied the downloaded VIM-Latex plugin files into my ~/.vim/bundle directory.
I also edited the .vimrc according to the instructions specified here.
However, I'm getting the following errors on trying to open a tex document in MAC Vim:
File "/Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex- suite/outline.py", line 12, in <module>
import StringIO
ImportError: No module named StringIO
Error detected while processing /Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-suite/main.vim:
and
File "/Users/username/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-suite/pytools.py", line 1, in <module>
import string, vim, re, os, glob
ImportError: No module named string
Also, I ran a basic python script from the terminal that imported StringIO and string, and both seem to be getting imported just fine.
I'm not sure where the problem is here. Since I'm really new both with VIM and Installing Plugins, I'm not sure how I should go about debugging this issue, and so, any help will be precious!
Thanks!
StringIO and string are not available in Python 3.x. To make this code work, you have to run it with Python 2.x, e.g. Python 2.7.