I am trying to run python from a network share on windows 7.
The network share is T:
>t:\python-2.6.1\python
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import httplib2
httplib2\__init__.py:29: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "T:\python-2.6.1\lib\python2.6\site-packages\httplib2\__init__.py", line 36, in <module>
import httplib
File "T:\python-2.6.1\lib\httplib.py", line 77, in <module>
import mimetools
File "T:\python-2.6.1\lib\mimetools.py", line 6, in <module>
import tempfile
File "T:\python-2.6.1\lib\tempfile.py", line 34, in <module>
from random import Random as _Random
File "T:\python-2.6.1\lib\random.py", line 871, in <module>
_inst = Random()
File "T:\python-2.6.1\lib\random.py", line 96, in __init__
self.seed(x)
File "T:\python-2.6.1\lib\random.py", line 110, in seed
a = long(_hexlify(_urandom(16)), 16)
WindowsError: [Error 127] The specified procedure could not be found
When I copy python-2.6.1 to my local drive it works fine. It also works fine on my windows XP machine using the same network share.
Peter,
When I copy python-2.6.1 from the network share to my local drive it works fine. It also works fine on my windows XP machine using the same network share.
Related
I am new to Python so I could perhaps learn the basics first... I'm a musician and keen to learn how to use Python with music.
I installed Python 3.8 x64 for Windows 10. I then used pip to install music21.
Opened the Python Shell, typed import music21 and got this:
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import music21
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import music21
File "D:\Python\lib\site-packages\music21\__init__.py", line 170, in <module>
from music21 import base
File "D:\Python\lib\site-packages\music21\base.py", line 94, in <module>
from music21 import common
File "D:\Python\lib\site-packages\music21\common\__init__.py", line 39, in <module>
from music21.common.parallel import *
File "D:\Python\lib\site-packages\music21\common\parallel.py", line 19, in <module>
from music21.ext.joblib import Parallel, delayed # #UnresolvedImport # type: ignore
File "D:\Python\lib\site-packages\music21\ext\joblib\__init__.py", line 119, in <module>
from .parallel import Parallel
File "D:\Python\lib\site-packages\music21\ext\joblib\parallel.py", line 32, in <module>
from .externals.cloudpickle import dumps, loads
File "D:\Python\lib\site-packages\music21\ext\joblib\externals\cloudpickle\__init__.py", line 3, in <module>
from .cloudpickle import *
File "D:\Python\lib\site-packages\music21\ext\joblib\externals\cloudpickle\cloudpickle.py", line 167, in <module>
_cell_set_template_code = _make_cell_set_template_code()
File "D:\Python\lib\site-packages\music21\ext\joblib\externals\cloudpickle\cloudpickle.py", line 148, in _make_cell_set_template_code
return types.CodeType(
TypeError: an integer is required (got type bytes)
I have found example code to run with music21 but I can't use it if I get errors.
Hope someone can help. Apologies if I'm being a complete n00b. Did look at other questions but didn't find or didn't understand the answers.
So from your output, the main piece that seems most useful is the TypeError: an integer is required (got type bytes) in the _make_cell_set_template_code function in the D:\Python\lib\site-packages\music21\ext\joblib\externals\cloudpickle\cloudpickle.py file. This issue could be an issue with music21 not being compatible with Python 3.8. I'm reading the documentation from https://web.mit.edu/music21/ and it says v.5 support Python 3.4-3.6, so I would try to get on one of those versions and restart the process you did to get to the step above. Hope this helps!
music21 v5 does not support Python 3.8 -- choose 3.7 or download the latest Git from github.
EDIT: v5.7.2 now supports 3.8
When using python through the commandline, I am able to import modules fine. However, when I build a python script in SublimeText3, some modules don't import. I generally receive the following error:
ImportError: DLL load failed: The specified module could not be found.
The problem looks to involve modules with dependencies on modules with a "_" prefix (_sqlite3, _ssl). For example:
File "C:\ProgramData\anaconda3\Lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\ProgramData\anaconda3\Lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
System:
Windows 10
SublimeText3 (freshly reinstalled during troubleshooting)
Python 3.7.3 [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
(freshly reinstalled during troubleshooting)
Both commandline and ST3 or pointing to same instance of Python.
This is the only python install on the machine.
Have used default Python build in ST3 and created a new build, both have same issue.
Results when using the commandline:
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import plotly
>>>
Results in ST3:
import plotly
Traceback (most recent call last):
File "C:\Users\usr\Desktop\scrap.py", line 1, in <module>
import plotly
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\__init__.py", line 32, in <module>
from plotly import (
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\graph_objs\__init__.py", line 3, in <module>
from plotly.basedatatypes import BaseLayoutType as _BaseLayoutType
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\basedatatypes.py", line 25, in <module>
from .callbacks import (Points, InputDeviceState)
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\callbacks.py", line 2, in <module>
from plotly.utils import _list_repr_elided
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\utils.py", line 262, in <module>
from chart_studio.utils import *
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\__init__.py", line 2, in <module>
from chart_studio import (plotly, dashboard_objs, grid_objs, session)
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\__init__.py", line 10, in <module>
from . plotly import (
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\plotly.py", line 38, in <module>
from chart_studio.plotly import chunked_requests
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\chunked_requests\__init__.py", line 1, in <module>
from . chunked_request import Stream
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\chunked_requests\chunked_request.py", line 4, in <module>
import ssl
File "C:\ProgramData\anaconda3\Lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.
[Finished in 2.9s]
Any help much appreciated, been stuck on this for days.
For those with a similar issue in the future, I've fixed this by uninstalling the Anaconda distribution of Python and replacing it with a base Python installation from Python.org, then installing packages using pip manually. While not the ideal solution, this has solved the issue so that when I build a Python script in ST3, all modules are imported fine.
I managed to break one of my virtual environments. I think I did it by installing pycrypto with pip and uninstalling it with easy_install.
This is what I get when I run python in the venv.
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$ python
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in <module>
import os
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 49, in <module>
import posixpath as path
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 17, in <module>
import warnings
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/warnings.py", line 8, in <module>
import types
File "types.py", line 1, in <module>
import json
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 3, in <module>
import re
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 280, in <module>
import copy_reg
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy_reg.py", line 7, in <module>
from types import ClassType as _ClassType
ImportError: cannot import name ClassType
filip#dratmac:~/PycharmProjects/Project-Marketplace2/backend/odb/helper_objects$
And outside the venv everything works as expected:
Last login: Tue Apr 7 22:30:08 on ttys005
filip#dratmac:~$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
How can I fix this?
You should not name your file types.py as there is a standard library module with the same name (import types).
As such, Python tries to import it as part of some standard library code but it now actually imports your local types.py file, not the module it expects.
So the problem should be fixed when you rename types.py to something else.
I can't import ctypes on the production GAE server, which is causing our code to break. Seemingly, urllib and urllib2 also rely on this library, but somehow it's possible to import them on production through the console (e.g. navigate to www.myapp.com/console). Is this a feature or a bug? Thanks!
Python 2.5.2 (r252:60911, Mar 17 2011, 15:16:30)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(Google App Engine/1.5.1)
>>> from lib import cloud
Traceback (most recent call last):
File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/console/app/models/console.py", line 170, in processSource
exec bytecode in statement_module.__dict__
File "<string>", line 1, in <module>
File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/__init__.py", line 102, in <module>
from . import cloudconfig as cc
File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/cloudconfig.py", line 50, in <module>
from .util import configmanager
File "/base/data/home/apps/s~getprofound1/1-01.351465921648985319/lib/cloud/util/__init__.py", line 25, in <module>
import ctypes
File "/base/python_runtime/python_dist/lib/python2.5/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: No module named _ctypes
ctypes is not available in the Python 2.5 runtime or in the current Python 2.7 runtime. See the knowledge base for more details and this list enumerating white-listed module.
I have this pyopengl application and I'm trying to freeze it with bbfreeze. Unfortunately when I run the frozen app it errors with this:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "__main__.py", line 128, in <module>
File "__main__client__.py", line 11, in <module>
File "ui.py", line 15, in <module>
File "OpenGL/GLUT/__init__.py", line 2, in <module>
File "OpenGL/raw/GLUT/__init__.py", line 6, in <module>
File "OpenGL/raw/GLUT/constants.py", line 7, in <module>
File "OpenGL/platform/__init__.py", line 36, in <module>
File "OpenGL/platform/__init__.py", line 27, in _load
File "OpenGL/plugins.py", line 14, in load
File "OpenGL/plugins.py", line 28, in importByName
ImportError: No module named glx
Here's the requisite version information:
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenGL
>>> OpenGL.__version__
'3.0.1b2'
>>> import bbfreeze
>>> bbfreeze.version
(0, 97, 3)
I'm trying to run it on the same machine I'm freezing it on, and the unfrozen app runs fine on that machine.
Has anyone managed to make this work? or perhaps provide some debugging guidance?
Try explicitly adding "OpenGL.platform.glx" to the list of included modules in the freeze. I think the bbfreeze option "includes" is what you want.
Update: take a look at the way PyInstaller does it: http://www.pyinstaller.org/browser/trunk/PyInstaller/hooks/hook-OpenGL.py
You will probably need to add all of these modules to your list of includes.
I am also facing the same challenge until I read the documention, which states that:
bbfreeze has been tested with python 2.4, 2.5 and 2.6. bbfreeze will not work with python versions prior to 2.3 as it uses the zipimport feature introduced with python 2.3.
So i think the best to do is to use the versions of python mentioned! Hope this helps!