python-3.3

Bash alias --> Python 2.7 to Python 3.3

有些话、适合烂在心里 提交于 2019-12-04 09:23:43
I am trying to make Python 3.4.2 the default in Linux (currently it is 2.7.6). I am not very knowledgeable on this stuff, but I have read in several places online that you can simply put an alias in the ~/.bashrc or ~/.bash_aliases file like this: alias python='python3' I don't have either the ~/.bashrc or ~/.bash_aliases file . . . I am assuming you can just create them. I have done that, but the alias doesn't seem to be working. Am I missing something? Do you need the shebang at the beginning of the file? I have tried it both ways. Thanks for any help you can give! Seçkin Savaşçı DON'T DO IT

winpdb not working with python 3.3

不羁的心 提交于 2019-12-04 09:03:29
I can't get rpdb2 to run with python 3.3, while that should be possible according to several sources. $ rpdb2 -d myscript.py A password should be set to secure debugger client-server communication. Please type a password:x Password has been set. Traceback (most recent call last): File "/usr/local/bin/rpdb2", line 31, in <module> rpdb2.main() File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14470, in main StartServer(_rpdb2_args, fchdir, _rpdb2_pwd, fAllowUnencrypted, fAllowRemote, secret) File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14212, in StartServer g_module

How to update values to the listbox under Combobox in ttk Python33

空扰寡人 提交于 2019-12-04 08:44:59
问题 When I create the Combobox, it has no items in the list. Now when I click on the dropdown button a function is called (via the postcommand option), but once in my function I don't know how to set the values in the listbox of the Combobox. Code something like this: #update list upon drop down self.cbox = Combobox(self, width = 10, postcommand = self.updtcblist) def updtcblist(self): list = self.getPortLst() self.cbox.getlistbox.set(list) #getlistbox doesn't work Thanks, Harvey 回答1: Answered my

Installing newest Python on openSUSE

萝らか妹 提交于 2019-12-04 08:40:43
I installed Python on an openSUSE system (see version below) using the Zypper package manager. This gives me Python 3.2, but some packages require Python 3.3. Updating with zypper update python3 stays on Python 3.2. How can I upgrade to 3.3, ideally using the package manager and reusing the rest of my working Python installation (site packages, pip...)? openSUSE 12.2 (x86_64) VERSION = 12.2 CODENAME = Mantis You can add the devel:languages:python:Factory repository or use the 1 Click Install and a Python 3.3.2 version form here (e.g. from the above repo). (Show other versions->openSUSE 12.2-

Passing the library path as a command line argument to setup.py

落爺英雄遲暮 提交于 2019-12-04 02:56:54
modules = [Extension("MyLibrary", src, language = "c++", extra_compile_args=["-fopenmp", "-std=c++11", "-DNOLOG4CXX"], # log4cxx is not currently used extra_link_args=["-fopenmp", "-std=c++11"], include_dirs=[os.path.join(os.path.expanduser("~"), (os.path.join(gtest, "include"))], library_dirs=[log4cxx_library, os.path.join(os.path.expanduser("~"), gtest)], libraries=["log4cxx", "gtest"])] This is a part of my setup.py script. How do I pass options like include_dirs or library_dirs through command line arguments, so that path could be set up by the user? Think this may be what you're looking

Non-blocking multiprocessing.connection.Listener?

拟墨画扇 提交于 2019-12-04 01:06:14
I use multiprocessing.connection.Listener for communication between processes, and it works as a charm for me. Now i would really love my mainloop to do something else between commands from client. Unfortunately listener.accept() blocks execution until connection from client process is established. Is there a simple way of managing non blocking check for multiprocessing.connection? Timeout? Or shall i use a dedicated thread? # Simplified code: from multiprocessing.connection import Listener def mainloop(): listener = Listener(address=(localhost, 6000), authkey=b'secret') while True: conn =

Ubuntu - How to install a Python module (BeautifulSoup) on Python 3.3 instead of Python 2.7?

↘锁芯ラ 提交于 2019-12-03 17:11:29
问题 I have this code (as written in BS4 documentaion): from bs4 import BeautifulSoup When I run the script (using python3) I get the error: ImportError: No module named 'bs4' So installed BeatifulSoup by: sudo pip install BeatifulSoup4 But when I try to run the script again I get the same error. Indeed BS4 is installed in: BeautifulSoup4 in /usr/local/lib/python2.7/dist-packages But I want to install and use it with python3.3 (as there are other module which are not working with python2.7). I

Python 3.3 - Connect with Oracle database

瘦欲@ 提交于 2019-12-03 15:21:15
Is there a module for python 3.3 to connect with Oracle Databases? Which is the easiest to use? Something like the mysql module, only works with Oracle. Preferably version 10g, but 11g will do just fine. There is: cx_Oracle # Install --> You should have oracle installed otherwise exception will be raised pip install cx_Oracle import cx_Oracle con = cx_Oracle.connect('pythonhol/welcome@127.0.0.1/orcl') print con.version con.close() http://www.orafaq.com/wiki/Python http://www.oracle.com/technetwork/articles/dsl/python-091105.html 来源: https://stackoverflow.com/questions/19042353/python-3-3

Installing Python 3.3 on Cygwin

独自空忆成欢 提交于 2019-12-03 13:04:06
I'm having trouble installing Python 3.3 on Cygwin. I've tried installing from source, but make returns: gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/signalmodule.c -o Modules/signalmodule.o In file included from Include/Python.h:84:0, from ./Modules/signalmodule.c:6: ./Modules/signalmodule.c: In function `fill_siginfo': ./Modules/signalmodule.c:745:60: error: `siginfo_t' has no member named `si_band' PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(si->si_band)); ^ Include/tupleobject.h:62:75: note: in

How to delete everything after a certain character in a string?

余生长醉 提交于 2019-12-03 12:36:42
How would I delete everything after a certain character of a string in python? For example I have a string containing a file path and some extra characters. How would I delete everything after .zip? I've tried rsplit and split , but neither included the .zip when deleting extra characters. Any suggestions? Just take the first portion of the split, and add '.zip' back: s = 'test.zip.zyz' s = s.split('.zip', 1)[0] + '.zip' Alternatively you could use slicing, here is a solution where you don't need to add '.zip' back to the result (the 4 comes from len('.zip') ): s = s[:s.index('.zip')+4] Or