"AttributeError: fileno" when attemping to import from pyevolve - python

I just installed Pyevolve using easy_install and I am getting errors trying to run my first program. I first tried copy and pasting the source code of the first example but this is what I receive when I attempt to run it:
Traceback (most recent call last):
File "/home/corey/CTest/first_intro.py", line 3, in
from pyevolve import G1DList
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/init.py", line 15, in
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/Consts.py", line 240, in
import Selectors
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/Selectors.py", line 12, in
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/GPopulation.py", line 11, in
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/FunctionSlot.py", line 14, in
File "/usr/lib/python2.6/site-packages/Pyevolve-0.5-py2.6.egg/pyevolve/Util.py", line 20, in
AttributeError: fileno
I am running python 2.6 on Fedora 11 X86_64.
Edit: After looking into it more if I run python from the command line it works but it only fails when I'm running IDLE.

Have you tried to check out the Development version ? It's near of the RC1, so it is stable right now:
svn co https://pyevolve.svn.sourceforge.net/svnroot/pyevolve/trunk pyevolve
Your problem seems to be the paths, try uncompressing the "egg" file and put the "pyevolve" directory in the site-packages or inside your application directory.

Related

ModuleNotFoundError on jenkins build cannot be replicated locally

Running an exe file which gives the below error on win10 build agent but not when the same script is ran on win10 locally:
16:06:50 Traceback (most recent call last):
16:06:50 File "C:\ProgramData\Anaconda3\envs\conda_venv\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
16:06:50 File "C:\ProgramData\Anaconda3\envs\conda_venv\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
16:06:50 File "package.py", line 98, in <module>
16:06:50 File "C:\ProgramData\Anaconda3\envs\conda_venv\lib\site-packages\testing_framework_sdk\__init__.py", line 15, in <module>
16:06:50 ModuleNotFoundError: No module named 'test_case_sdk'
Both files are ran from the same downloaded package with no changes in contents between the two.
Script does not require additional programs such as Python in order to operate.
Given that library files(.pyc) are contained within the downloaded directory I assume that this exe was generated using pyinstaller. python36.dll is also contained within the downloaded package
I don't have access to the source for this exe.
The file test_case_sdk.pyc does exist in the same directory for both the jenkins agent and local machine.
Do anyone know what is causing this discrepancy?
Edit: Turns out the filepath to test_case_sdk exceeded windows default limit of 260, this was why the module could not be found. I condensed the file path, error has gone.

Error running executable compiled with py2exe

I'm trying use py2exe to compile an eye tracking experiment written in Python 2.7 (32-bit). The experiment uses the psychopy library. I wrote the experiment using the PyCharm IDE, and the experiment runs when I run it through the PyCharm IDE, using an interpreter in a virtual environment located at C:\Users\phil\Python_2.7_32-bit.
The experiment compiles without generating any errors when I enter the following command into the command prompt: C:\Users\phil\Python_2.7_32-bit\Scripts\python.exe C:\Users\phil\PycharmProjects\iTRAC\VisSearch\setup.py py2exe.
When I run the executable generated by the above py2exe command, I get this error:
Traceback (most recent call last):
File "VisualSearch.py", line 3, in <module>
File "psychopy\__init__.pyc", line 39, in <module>
File "psychopy\preferences\__init__.pyc", line 5, in <module>
File "psychopy\preferences\preferences.pyc", line 172, in <module>
File "psychopy\preferences\preferences.pyc", line 33, in __init__
File "psychopy\preferences\preferences.pyc", line 98, in loadAll
File "psychopy\preferences\preferences.pyc", line 146, in loadAppData
File "psychopy\preferences\configobj.pyc", line 583, in __getitem__
KeyError: 'builder'
My setup.py script is as follows:
from distutils.core import setup
import py2exe
setup(windows =['C:\Users\phil\PycharmProjects\iTRAC\VisSearch\VisualSearch.py'])
I've also tried using the following setup.py script with the same results:
from distutils.core import setup
import py2exe
setup(windows = [{'script':'C:\Users\phil\PycharmProjects\iTRAC\VisSearch\VisualSearch.py',
'options' : {'py2exe':{'includes':['psychopy'],
'compressed': True,
'bundle_files': 1,}}}])
I googled the error and came up with 0 results.
Can anybody tell me why I am running into this error?
This is probably a missing config/prefs file. PsychoPy uses the configobj library to read and validate preferences but my guess is that py2exe is only automatically packaging py/pyc files and needs to include the .spec files in the psychopy/preferences folder.

Python error: No module named RuntimeError

Im trying to figured out this problem. Yesterday I installed PyScripter and since then, scripts doesnt work. When I run any script (in PyScripter or IDLE) and trying to "import arcpy", it gets this error:
import arcpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import arcpy
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 17, in <module>
from geoprocessing import gp
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from _base import *
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\Python26\ArcGIS10.0\lib\arcgisscripting.py", line 81, in <module>
from RuntimeError import RuntimeError
ImportError: No module named RuntimeError
Have somebody any suggestion how to fix it?
Thanks to all very much!
Sounds like the module is not installed properly (or at all). To verify, do the following:
open a shell and start the python shell by typing python
(If this doesn't display an error, check that python is added to your system path or if it is even installed at all. But if you've used Python on said machine maybe system path issue)
enter the commmand help('modules')
review the list of modules that's returned to see whether arcpy is included
if not, then you may have to reinstall the module

Scrapy not recognised command

I have successfully installed Scrapy and all it's dependencies into Python.org 64 shell on a Windows Vista 64 bit platform. This is installed as Site Package. I have tested Scrapy works ok at a basic level by typing:
Import Scrapy
Into a Python Shell and got no errors. I've just got started with tutorials on how to use Scrapy. Most of these suggest setting up a new project using the following Command Prompt line:
C:\Python27>scrapy startproject myproject
However this throws up the error message in the title about Scrapy being an invalid command. I have tried amending my environment variables to allow me to use this command from any file location within Command Prompt. I have added the following to the end of my environment variables:
C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages\scrapy;C:\Python27\Scrapy
This does not seem to resolve the problem however as I still get the same error message. I have also tried running the 'scrapy startproject myproject' command from the following locations with Command Prompt:
C:\Python27
C:\Python27\Scripts
C:\Python27\Scrapy
This again still throws up the same error message. I feel like I am quite close to having the solution, but I just cant quite seem to make it work.
Can anyone spot where I am going wrong?
Thanks
EDIT:
In response to the last comment above from MattDMo, the command now works, however it now throws up the following error message, which I'm not even sure where to start with:
C:\Python27\Scripts>scrapy startprogram mrscript
Traceback (most recent call last):
File "c:\Python27\Scripts\scrapy", line 3, in <module>
from scrapy.cmdline import execute
File "c:\Python27\lib\site-packages\scrapy\cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "c:\Python27\lib\site-packages\scrapy\crawler.py", line 3, in <module>
from twisted.internet import reactor, defer
File "c:\Python27\lib\site-packages\twisted\internet\reactor.py", line 38, in
<module>
from twisted.internet import default
File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 56, in
<module>
install = _getInstallFunction(platform)
File "c:\Python27\lib\site-packages\twisted\internet\default.py", line 50, in
_getInstallFunction
from twisted.internet.selectreactor import install
File "c:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 1
8, in <module>
from twisted.internet import posixbase
File "c:\Python27\lib\site-packages\twisted\internet\posixbase.py", line 24, i
n <module>
from twisted.internet import error, udp, tcp
File "c:\Python27\lib\site-packages\twisted\internet\tcp.py", line 29, in <mod
ule>
from twisted.internet._newtls import (
File "c:\Python27\lib\site-packages\twisted\internet\_newtls.py", line 21, in
<module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "c:\Python27\lib\site-packages\twisted\protocols\tls.py", line 41, in <mo
dule>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "c:\Python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "c:\Python27\lib\site-packages\OpenSSL\rand.py", line 11, in <module>
from OpenSSL._util import (
File "c:\Python27\lib\site-packages\OpenSSL\_util.py", line 4, in <module>
binding = Binding()
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 87, in __init__
self._ensure_ffi_initialized()
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 106, in _ensure_ffi_initialized
libraries=libraries,
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", li
ne 80, in build_ffi
extra_link_args=extra_link_args,
File "c:\Python27\lib\site-packages\cffi\api.py", line 341, in verify
lib = self.verifier.load_library()
File "c:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_librar
y
return self._load_library()
File "c:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_libr
ary
return self._vengine.load_library()
File "c:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 138, in load_li
brary
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing 'c:\\Python27\\lib\\site-packages\
\cryptography\\_Cryptography_cffi_444d7397xa22f8491.pyd': DLL load failed: The s
pecified module could not be found.
Is this actually an error log or just a standard print out? Also, could someone explain please why adding a .bat file to my Python scripts causes this to work?
Thanks
pip install scrapy installs a file called scrapy in Python's Scripts directory on Windows, the default location for which is C:\Python27\Scripts. However, C:\Python27\Scripts\scrapy is a Python file, even though it lacks the .py suffix. There are two ways of running it. My preferred method is to use the Git Shell, as scrapy has its executable bit set, and can be run without further ado.
The other method, if you want to keep using cmd.exe, is to make a batch file with the following contents:
#echo off
c:\Python27\python c:\Python27\Scripts\scrapy %*
Save it in the Scripts directory as scrapy.bat (assuming your PATH now includes C:\Python27;C:\Python27\Scripts), restart cmd.exe, and you should now be able to run it from the command line.
I experienced a similar problem (I'm using a virtual environment in Windows 7).
I noticed that for older versions of scrapy, e.g. pip install scrapy==0.18.4, it automatically creates a scrapy.bat in my virtual environment: {VENV_ROOT_FOLDER}\Scripts\scrapy.bat
But if I use the latest scrapy (currently version 0.24.2), the scrapy.bat is missing.
I wanted to use the latest scrapy version, so what I did is to put a copy of scrapy.bat to its Scripts folder and it solves the problem.

Python pyinstaller and translit module

I'm using module transliterate.py from standard translit python libraries.
When I compile my GUI application, it raises the next error.
Traceback (most recent call last):
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\addobjectdialog", line 265, in OnTextName
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\core.utils", line 536, in translit
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.utils", line 41, in translit
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.utils", line 29, in ensure_autodiscover
File "C:\Users\...\...\build\Rman\out00-PYZ.pyz\transliterate.discover", line 27, in autodiscover
WindowsError: [Error 3] : 'C:\\...\\...\\AppData\\Local\\Temp\\_MEI11122\\transliterate\\contrib\\languages/*.*'
How I understand, I have to place
that lib somewhere within my application. But I just compile one .exe file, so wouldn't like to keep yet one file with my exe.
BTW, app is ran under Win 7 / 32bit.
Thanks.
That may be one of those libraries that you have to include explicitly. I know I had to do that from time to time with py2exe. See the following docs for more information:
http://pythonhosted.org/PyInstaller/#options-for-finding-imported-modules-and-libraries

Categories