python-3.4

Windows 10 and Unable to find vcvarsall.bat

谁说我不能喝 提交于 2019-11-28 06:04:41
When I try to build one package: C:\Linter\intlib\PYTHON>python setup.py build I get this error message: running build running build_ext building 'LinPy' extension error: Unable to find vcvarsall.bat This is my Python version: Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32 And I'm working on Windows 10 x64. I know about this thread and dozens of others (like this and this and the list goes on). So, I guess I tried almost everything, but nothing works. It seems like all those threads have become outdated, so I need some new receipt. BTW. I tried

Python : Typeerror : Non-empty format string passed to object.__format__

会有一股神秘感。 提交于 2019-11-28 05:03:03
问题 I know this question has been asked here but the solution does not work for me. I am using python 3.4 . I have the following formatting in my script : print ( "\t {0:20} {1:<11} {2:<25} {3:11} {4:11} {5:>32}".format( files.name.split('/')[-1], sizeof_fmt(files.size), str( formatted_timestamp ), files.owner, files.version_id, files.etag )) This works in python 2.7.x . But in 3.4 I get the error: File "test.py", line 3, in file_print versionid, etag )) TypeError: non-empty format string passed

Python - Can't Install Packages: TypeError: unorderable types: NoneType() >= str()

时光毁灭记忆、已成空白 提交于 2019-11-28 03:55:23
问题 System: Win7 64, Python 3.4, Pycharm 3.0.2, MinGW Whenever I try to install a package, in Pycharm or via command line, I get this: running install running build running build_py running build_ext Traceback (most recent call last): File "C:\Users\MyAccount\Downloads\scandir-master\scandir-master\setup.py", line 48, in <module> 'Programming Language :: Python :: Implementation :: CPython', File "C:\Python34\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python34\lib

How do I unescape a unicode escaped string in python?

蓝咒 提交于 2019-11-28 00:18:37
I have a unicode escaped string: > str = 'blah\\x2Ddude' I want to convert this string into the unicode unescaped version 'blah-dude' How do I do this? roippi Encode it to bytes (using whatever codec, utf-8 probably works) then decode it using unicode-escape : s = 'blah\\x2Ddude' s.encode().decode('unicode-escape') Out[133]: 'blah-dude' 来源: https://stackoverflow.com/questions/22601291/how-do-i-unescape-a-unicode-escaped-string-in-python

urllib HTTPS request: <urlopen error unknown url type: https>

笑着哭i 提交于 2019-11-27 23:46:36
I have a script on python3.4 and it has been fine until the website I download the file from decides to use https and now I am getting error but can't figure out how I can retrive the file. My script import the following library and uses the urlretrive to get the file previously. Since it is now forwarded to https with 302 redirection. I am getting some error. import urllib import urllib.request urllib.request.urlretrieve("http://wordpress.org/latest.tar.gz", "/thefile.gz") My error:- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.4/urllib

enum - getting value of enum on string conversion

半腔热情 提交于 2019-11-27 19:57:24
I have following enum defined from enum import Enum class D(Enum): x = 1 y = 2 print(D.x) now the printed value is D.x instead I wanted the enum's value to be print 1 Hhat can be done to achieve this functionality? You are printing the enum object . Use the .value attribute if you wanted just to print that: print(D.x.value) See the Programmatic access to enumeration members and their attributes section : If you have an enum member and need its name or value: >>> >>> member = Color.red >>> member.name 'red' >>> member.value 1 You could add a __str__ method to your enum, if all you wanted was to

Difference in package importing between Python 2.7 and 3.4

∥☆過路亽.° 提交于 2019-11-27 17:44:49
问题 For this directory hierarchy: . ├── hello │ ├── __init__.py │ └── world │ └── __init__.py └── test.py And the Python source files: test.py: if __name__ == '__main__': import hello hello/__init__.py: import world hello/world/__init__.py: print("yes you win") Running test.py with Python 3.4 throws ImportError saying that module world is not found, but with Python 2.7 everything is fine. I know that sys.path is referenced when searching for the imported modules, so adding the directory hello to

Is it possible to override __new__ in an enum to parse strings to an instance?

烈酒焚心 提交于 2019-11-27 16:32:45
问题 I want to parse strings into python enums. Normally one would implement a parse method to do so. A few days ago I spotted the __new__ method which is capable of returning different instances based on a given parameter. Here my code, which will not work: import enum class Types(enum.Enum): Unknown = 0 Source = 1 NetList = 2 def __new__(cls, value): if (value == "src"): return Types.Source # elif (value == "nl"): return Types.NetList # else: raise Exception() def __str__(self): if (self ==

Python 3.4.1 script syntax error, arcpy &

℡╲_俬逩灬. 提交于 2019-11-27 16:23:47
I am used to working in python 2.7 so there was some new things like the print function being different. So excuse my ignorance. I am also pretty new to programming. So here is my script, I keep getting errors that highlight some commas or spaces and saying there is a SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: malformed \N character escape Code: import arcpy print("mosaic to new raster starting!") env.workspace = "F:\GDAL" arcpy.env.pyramid = "NONE" arcpy.env.rasterStatistics = "NONE" arcpy.env.compression = "JPEG 87" arcpy.env.tileSize = "256 256"

Tkinter, Windows: How to view window in windows task bar which has no title bar?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 16:12:35
I created a window: root = Tk() and removed the titlebar: root.overrideredirect(True) Now the window is not on the task bar in windows. How can i show it in the task bar? (I only want to bring my window to the front if other windows are on top of mine) Tk does not provide a way to have a toplevel window that has overrideredirect set to appear on the taskbar. To do this the window needs to have the WS_EX_APPWINDOW extended style applied and this type of Tk window has WS_EX_TOOLWINDOW set instead. We can use the python ctypes extension to reset this but we need to note that Tk toplevel windows