Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2012-01-08 16:29:08.923
Changing privacy of old Facebook posts using the Graph API
So I was flicking through my Facebook Timeline, and started to look at some old posts I made in 2009~2010. And they're a bit stupid and I'd like to remove them or change the privacy settings on them. There are too many to do it individually, so I've been looking at the Graph API. However, I have been unable to find an...
1) Nope. 2) Yes, you can use the Graph API and HTTP Get me/feed?until={date}
1.2
true
1
1,609
2012-01-09 15:12:36.140
Convert HTML HEX Color or RGB tuple to X11 color
I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can d...
You can't convert to x11 colors automatically. x11 colors are basically just names mapped to arbitrary RGB values, so the only way to get from RGB to x11 is to reverse the map. If you want to convert an RGB color that isn't in x11 to the closest match in x11 that would be pretty difficult.
0.101688
false
2
1,610
2012-01-09 15:12:36.140
Convert HTML HEX Color or RGB tuple to X11 color
I'm searching for a single function to convert RGB tuple (255, 255, 255) or HTML hex (#FFFFFF) to X11 color (0...255 int) to manage colors in Unix terminal. I've looked over the internet but I didn't find anything like that, so I'm asking for code or link to a website that contains code or information about how I can d...
If I understand your question properly, I don't think you can do this. The RGB tuple (and its representation as a 6-digit hex number for HTML) represents a specific color in the RGB colorspace. The single integer in the range 0 to 255 you mention for the Unix terminal isn't a specific color, but rather an index into a ...
0.101688
false
2
1,610
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
One way to run IDLE from spotlight or an icon in the Applications folder is to build a quick Automation for it. As mentioned by other commentators, this probably isn't necessary for Python 3, as it creates a shortcut automatically, and some hand-installed versions have tools to do this automatically. But if you want t...
0.485849
false
6
1,611
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
After you launch idle from the command line (make sure idle shell window has focus), click File, click "New File". A new window opens; this is your editor. Type your program in the editor. Click "File", click "Save As...". Save your file somewhere with any name you choose, and a ".py" extension to the file name. Click...
0.040794
false
6
1,611
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
As to the earlier questions about starting IDLE: you can certainly start it from the command line. Also, if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder).
0
false
6
1,611
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. For a more Mac-like way of opening it, you'll have to create a small app or shortcut to laun...
1.2
true
6
1,611
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
The answer of Matthewm1970 works like a charm! And if you add an & to your shell command, the automation script will end immediately. There is no spinning gear. Like so: /usr/local/bin/idle3.5& Note the ampersand. Cheers. -melle
0.040794
false
6
1,611
2012-01-09 16:50:24.777
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
first to launch the terminal CMD+space second to input idle3 the idle will be activated automatically.
0.081452
false
6
1,611
2012-01-09 19:02:37.120
any Python tools for reading Scantron-style data
I am interested in doing some snail mail based surveys but I am looking for quick ways to digitize the surveys they send back. So if I had a question and 5 boxes beneath it where you would indicate your opinion by checking the appropriate box, does anything exist where I could scan it and run it through a piece of soft...
I don't really see what this has to do with python, unless of course you've already digitized the results and are now looking to tally up the results. It sounds like you still need to scan the results in and as far as I know, python doesn't have any direct capabilities of doing something like that. You're going to have...
0.265586
false
1
1,612
2012-01-09 19:17:33.230
how to copy modules from one virtualenv to another
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
Usually you are able to copy the .egg-info from the lib/site-packages folder of the virtualenv to the lib/site-packages of the other environment.
0.081452
false
3
1,613
2012-01-09 19:17:33.230
how to copy modules from one virtualenv to another
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
seems like we can't just copy one virtualenv as another one. even you chnage the $VIRTUAL_ENV in the activate file, it still act as in origin virtualenv and pip will install all the packages to origin site-packages/
0.081452
false
3
1,613
2012-01-09 19:17:33.230
how to copy modules from one virtualenv to another
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
I was facing a problem installing 'wordcloud' on another Python venv on Windows 10. Package was installed on another project, same machine. copy "wordcloud" and "wordcloud-1.8.1.dist-info" folders from Users/<user>/PycharmProjects/<projectname>/venv/Lib/site-packages and paste to your new project /<projectname>/venv/Li...
0
false
3
1,613
2012-01-09 23:18:39.883
When coding in Python, how do I achieve guarantees of correctness similar to those I get with Haskell's type system?
Using Haskell's type system I know that at some point in the program, a variable must contain say an Int of a list of strings. For code that compiles, the type checker offers certain guarantees that for instance I'm not trying to add an Int and a String. Are there any tools to provide similar guarantees for Python code...
Python is dynamic and strongly typed programming language. What that means is that you can define a variable without explicitly stating its type, but when you first use that variable it becomes bound to a certain type. For example, x = 5 is an integer, and so now you cannot concatenate it with string, e.g. x+"hello"
0.386912
false
1
1,614
2012-01-09 23:46:39.250
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b? I know how to use thread synchronization primitives and thread-safe data structures, and in...
I've used pyserial in this way on Linux (and Windows), no problems !
0.496174
false
3
1,615
2012-01-09 23:46:39.250
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b? I know how to use thread synchronization primitives and thread-safe data structures, and in...
I would recommend to modify Thread B from "blocking read" to "non blocking read/write". Thread B would become your serial port "Daemon". Thread A could run at full speed for a friendly user interface or perform any real time operation. Thread A would write a message to Thread B instead of trying to write directly to th...
0
false
3
1,615
2012-01-09 23:46:39.250
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
I tried googling this, couldn't find an answer, searched here, couldn't find an answer. Has anyone looked into whether it's thread safe to write to a Serial() object (pyserial) from thread a and do blocking reads from thread b? I know how to use thread synchronization primitives and thread-safe data structures, and in...
I have done this with pyserial. Reading from one thread and writing from another should not cause problems in general, since there isn't really any kind of resource arbitration problem. Serial ports are full duplex, so reading and writing can happen completely independently and at the same time.
1.2
true
3
1,615
2012-01-10 18:27:38.723
how to deploy a hardened Thrift server for python?
There is probably a nice document that will help me. Please point to it. If I write a Thrift server using Python what is the best way to deploy it in a production environment? All I can find is examples of using the Python based servers that come with the distribution. How can I use Apache as the server platform for...
I assume that you are using the Python THttpServer? A couple of notes: 1) There is a comment in that code that reads """ This class is not very performant, but it is useful (for example) for acting as a mock version of an Apache-based PHP Thrift endpoint. """ I wouldn't recommend that you use it in production if you ...
0.201295
false
2
1,616
2012-01-10 18:27:38.723
how to deploy a hardened Thrift server for python?
There is probably a nice document that will help me. Please point to it. If I write a Thrift server using Python what is the best way to deploy it in a production environment? All I can find is examples of using the Python based servers that come with the distribution. How can I use Apache as the server platform for...
I've read that you can deploy it behind nginx using the upstream module to point to the thrift server. You should have at least one CPU core per thrift server and one left for the system (i.e. if you're on a quad-core, you should only run 3 thrift servers, leaving one left over for the system).
0.201295
false
2
1,616
2012-01-11 17:29:45.500
Huge memory usage by ipcontroller
I am using IPython 0.10.2 and Python 2.7 right now. I start one ipcontroller and 20 ipengines on my cluster. The code structure is very simple. I just use MultiEngineClient.execute() methods and MultiEngineClient dictionary interface (e.g., mec['a'] = b) . My current application needs to run nearly two days. However, a...
Unfortunately, it may not be possible to free memory effectively in the Controller in IPython 0.10, but the MultiEngineClient.clear_pending_results() method may help. The controller in 0.11-0.12 can use a database (sqlite or mongodb) to store results, and has been seen to run for a long time, with gigabytes of throughp...
1.2
true
1
1,617
2012-01-11 17:36:49.003
In emacs Python mode, how do I set a different auto-fill width for docstrings and code?
I would like to have auto-fill set to 79 columns for code sections and 72 for docstrings to get automatic PEP8 compliance. There seems to be an option to do this for Lisp mode (emacs-lisp-docstring-fill-column) but not for Python. Is there an enhanced python-mode.el around somewhere that includes this?
I don't know how to do that, but I've never felt the need. It is so easy to use C-x f to change the fill column. And you can just hit M-p to reuse the last value you entered. Just C-x f M-p --- 3 keystrokes.
0.386912
false
1
1,618
2012-01-11 21:11:09.043
QTableWidget how to have a cell selected for editing from code and/or with single click
Two part question: I have a 10x10 QTableWidget with QTableWidgetItem in each cell. For some reason, clicking on a cell is not sufficient to edit it, I need to double-click the cell to enter it. Is there a way to change this behavior to single click Is there a way to have 2nd cell in 1st row selected and ready for ed...
You can also use setCurrentCell. table.setCurrentCell(0,1) QTableWidget.setCurrentCell (self, int row, int column)
0.386912
false
1
1,619
2012-01-11 22:33:12.303
Rock paper Scissors bot algorithm
In my school our teacher is holding a Rock, paper, scissors bot competition. I know how to program in Python, but I have no idea how to program a bot that would have a bigger chance of success than one that randomly selects its weapons. I think it is possible to store all previous moves and then look for patterns in or...
Where might be some potential profit in trying to figure out the strategies of the other bots, for instance, if it's a forced participation, there will be some lazy student who makes up a bot that would always throw up scissors. I propose another strategy (I've heard about it on some similar competition, but can't trac...
0
false
2
1,620
2012-01-11 22:33:12.303
Rock paper Scissors bot algorithm
In my school our teacher is holding a Rock, paper, scissors bot competition. I know how to program in Python, but I have no idea how to program a bot that would have a bigger chance of success than one that randomly selects its weapons. I think it is possible to store all previous moves and then look for patterns in or...
It is proven for rock-paper-scissors that a random bot will be at the median of each rank. Therefore, I'd create a set of bots, each calculating one heuristic and running on the background on parallel. For each turn, each bot will virtually "draw" and check if he had won or lost - if it would have played this turn. Eac...
1.2
true
2
1,620
2012-01-12 18:15:21.740
OpenCV Lip Segmentation
How do people usually extract the shape of the lips once the mouth region is found (in my case using haar cascade)? I tried color segmentation and edge/corner detection but they're very inaccurate for me. I need to find the two corners and the very upper and lower lip at the center. I've heard things about active appea...
The color segementation involves "gradient of the difference between the pseudo-hue and luminance (obtaining hybrid contours)". Try googling for qouted string and you will find multiple research papers on this topic.
0
false
1
1,621
2012-01-13 03:15:46.143
How can i do replace a child element(s) in ElementTree
I want to replace child elements from one tree to another , based on some criteria. I can do this using Comprehension ? But how do we replace element in ElementTree?
You can't replace an element from the ElementTree you can only work with Element. Even when you call ElementTree.find() it's just a shortcut for getroot().find(). So you really need to: extract the parent element use comprehension (or whatever you like) on that parent element The extraction of the parent element can ...
1.2
true
1
1,622
2012-01-13 22:47:02.470
Quality Center VAPI-XP-TEST - Modify Default Python Script
I have a simple need with Quality Center 10 If you noticed in Quality Center Client on IE 8 -> Test Plan. If you create a new Testcase with Test Type = 'VAPI-XP-TEST', it will ask you for Script Language and Script Name. I have selected Script Language to be Python. Once you have gone through this process of creating a...
Can you post the default script here ? Iam not sure why you cant edit it ? You can edit the script as you want. There are 2 ways you can run the QC script one using VAPI-XP-TEST as you are doing , in that case you can use tdhelper object for updating the results. Second is OTA-API which you can use python script exte...
0
false
1
1,623
2012-01-14 00:11:10.770
converting a space delimited file to a CSV
I have a text file containing tabular data. What I need to do is automate the task of writing to a new text file that is comma delimited instead of space delimited, extract a few columns from existing data, reorder the columns. This is a snippet of the first 4 lines of the original data: Number of rows: 8542 Algor...
str.split() without any arguments will split by any length of whitespace. operator.itemgetter() takes multiple arguments, and will return a tuple.
0
false
1
1,624
2012-01-14 01:57:18.807
How can I use the mongolab add-on to Heroku from python?
The documentation only talks about how to do it from ruby.
Get the connection string settings by running heroku config on the command line after installed the add-on to your heroku app. There will be an entry with the key MONGOLAB_URI in this form: MONGOLAB_URI => mongodb://user:pass@xxx.mongolab.com:27707/db Simply the info from the uri in python by creating a connection from...
0.3154
false
1
1,625
2012-01-14 19:03:12.217
Convert netcdf to image
I have a netcdf file that I would like to convert to an image (joed, png, gif) using a command line tool. Is someone could please help me with the library name and possibly a link to how it is done. Regards David
IDV is a good visualization tool for NetCDF, but, as far as I know, there is no command line interface. I would recommend Matlab. It has read and write functions for NetCDF as well as an extensive plotting library...probably one of the best. You can then compile the matlab code and run it from the command line.
0
false
1
1,626
2012-01-15 20:43:10.640
What is a good way to draw images using pygame?
I would like to know how to draw images using pygame. I know how to load them. I have made a blank window. When I use screen.blit(blank, (10,10)), it does not draw the image and instead leaves the screen blank.
After using blit or any other update on your drawing surface, you have to call pygame.display.flip() to actually update what is displayed.
0.296905
false
1
1,627
2012-01-16 09:50:20.163
Python package won't upgrade
As part of a deployment procedure, I upload Python source packages (generated with setup.py sdist) to a remote server and install them in a virtualenv using pip install mypackage-1.0.tar.bz2. This has worked for long time both for new installs and upgrades (specifically, upgrades without a change in the package's versi...
pip install package will only be executed with you don't have this package already. With you want to upgrade the package you'll have to use: pip install -U package
1.2
true
1
1,628
2012-01-16 11:04:17.797
Aptana has started crashing - possibly due to Python or Git
I've been happily using Aptana for a PHP project. As of yesterday evening, it's been crashing repeatedly and causing no end of grief! I can pinpoint two events which may have caused this: Yesterday evening I seem to have hit a combination of keyboard keys which has resulted in 'Python not configured' appearing at the ...
i suggest you to click on: HELP -> About Aptana then: Installation Details (button on the bottom left) in the new window you can remove software, or revert some installation/configuration with with the "installation history" section. Hope this help you
0
false
1
1,629
2012-01-17 01:19:27.970
Match a line with multiple regex using Python
Is there a way to see if a line contains words that matches a set of regex pattern? If I have [regex1, regex2, regex3], and I want to see if a line matches any of those, how would I do this? Right now, I am using re.findall(regex1, line), but it only matches 1 regex at a time.
Try this new regex: (regex1)|(regex2)|(regex3). This will match a line with any of the 3 regexs in it.
0.613357
false
2
1,630
2012-01-17 01:19:27.970
Match a line with multiple regex using Python
Is there a way to see if a line contains words that matches a set of regex pattern? If I have [regex1, regex2, regex3], and I want to see if a line matches any of those, how would I do this? Right now, I am using re.findall(regex1, line), but it only matches 1 regex at a time.
You can use the built in functions any (or all if all regexes have to match) and a Generator expression to cycle through all the regex objects. any (regex.match(line) for regex in [regex1, regex2, regex3]) (or any(re.match(regex_str, line) for regex in [regex_str1, regex_str2, regex_str2]) if the regexes are not pre-co...
1.2
true
2
1,630
2012-01-18 06:48:57.963
how to make a lot of parameters available to the entire system?
I have objects from various classes that work together to perform a certain task. The task requires a lot of parameters, provided by the user (through a configuration file). The parameters are used deep inside the system. I have a choice of having the controller object read the configuration file, and then allocate the...
I have used the "global collection" alternative in the past. If you are concerned with naming: how would you handle this in your config file? The way I see it, your global collection is a datastructure representing the same information you have in your config file, so if you have a way of resolving or avoiding name cl...
1.2
true
1
1,631
2012-01-18 11:29:22.690
Python xlrd : how to convert an extracted value?
Well i have a question that i feel i've been answered several times, from what i found here. However, as a newbie, i can't really understand how to perform a really basic operation. Here's the thing : i have an .xls and when i use xlrd to get a value i'm just using sh.cell(0,0) (assuming that sh is my sheet); if what...
The correct answer to this is to simply use the Cell.value function. This will return a number or a Unicode string depending on what the cell contains.
0
false
1
1,632
2012-01-18 15:03:16.873
How to make a gui in python
I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don'...
If you're more into gaming you can use PyGame for GUIs.
0.040794
false
2
1,633
2012-01-18 15:03:16.873
How to make a gui in python
I was wondering if any of you know where I could find a simple tutorial on the web maybe to make a very simplistic gui. I have no idea how to start out in code to make one so I need your help. What I want the gui to be used for is I have written a program that I want to be to use it on other computers that already don'...
While some suggestions have included tkinter and wxPython, the other part of the answer to your question is that you will also need to package it using something like py2app, pyinstaller, or py2exe (depending on the operating system). You mentioned the other machines do not have python, so this would be required in ord...
0
false
2
1,633
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
Open your powershell as admin Enter "Set-ExecutionPolicy RemoteSigned -Force Run "gpedit.msc" and go to >Administrative Templates>Windows Components>Windows Powershell Look for "Activate scripts execution" and set it on "Activated" Set execution directive to "Allow All" Apply Refresh your env
0.047982
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
If some beginner, like me, has followed multiple Python tutorials now possible has multiple Python versions and/or multiple versions of pip/virtualenv/pipenv... In that case, answers listed, while many correct, might not help. The first thing I would try in your place is uninstall and reinstall Python and go from the...
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
I have a hell of a time using virtualenv on windows with git bash, I usually end up specifying the python binary explicitly. If my environment is in say .env I'll call python via ./.env/Scripts/python.exe …, or in a shebang line #!./.env/Scripts/python.exe; Both assuming your working directory contains your virtualen...
0.024005
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
For activation you can go to the venv your virtualenv directory by cd venv. Then on Windows, type dir (on unix, type ls). You will get 5 folders include, Lib, Scripts, tcl and 60 Now type .\Scripts\activate to activate your virtualenv venv. Your prompt will change to indicate that you are now operating within the vi...
0.246892
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
You can run the source command on cygwin terminal
0.024005
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
If you’re using Windows, use the command "venv\Scripts\activate" (without the word source) to activate the virtual environment. If you’re using PowerShell, you might need to capitalize Activate.
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
Open your project using VS code editor . Change the default shell in vs code terminal to git bash. now your project is open with bash console and right path, put "source venv\Scripts\activate" in Windows
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
If you are using windows OS then in Gitbash terminal use the following command $source venv/Scripts/activate. This will help you to enter the virtual environment.
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
Navigate to your virtualenv folder eg ..\project1_env> Then type source scripts/activate eg ..\project1_env>source scripts/activate
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
if .\venv\Scripts\activate does not work neither and you find this error \Activate.ps1 cannot be loaded because running scripts is disabled on this system you can simple type set-executionpolicy remotesigned in powershell and the error must be gone. powershell should run as administrator
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
Use These it worked for meenv\Scripts\activate
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
Some people are having trouble with vscode i assume as all the above methods dont work. Its simply because by default vscode uses powershell not cmd... click on the little arrow beside it and select cmd and run the command.
-0.012004
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
It's been a while without usign Django, so when I got back to my old project I run into the same issue on Windows 10 and this worked for me: venv/Scripts/activate
0
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
If you see the 5 folders (Include,Lib,Scripts,tcl,pip-selfcheck) after using the virtualenv yourenvname command, change directory to Scripts folder in the cmd itself and simply use "activate" command.
0.012004
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
The steps for activating virtualenv using Python3 on windows are: python3 -m venv env .\env\bin\activate
0.012004
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
For windows Microsoft Tech Support it might be a problem with Execution Policy Settings. To fix it, you should try executing Set-ExecutionPolicy Unrestricted -Scope Process
0.024005
false
17
1,634
2012-01-19 04:54:37.953
Issue with virtualenv - cannot activate
I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I'm thinking it migh...
If you are using windows, just run .\Scripts\activate. Mind that the backslash plays the trick!
0
false
17
1,634
2012-01-20 00:08:55.353
Sending 'secure' financial statements on S3
I need to provide individuals with their financial statement, and I am using S3. So far what I am doing is making the file public-read and creating a unique Key, using uuid.uuid4(). Would this be acceptable, or how else could I make this more secure? Sending authentication keys for each individual is not an option.
Even though version 4 UUIDs are supposed to incorporate random data, I wouldn't want to rely on the fact that the RNG used by Python's uuid.uuid4() being securely random. The Python docs make no mention about the quality of the randomness, so I'd be afraid that you might end up with guessable UUID's. I'm not a crypto e...
0.135221
false
1
1,635
2012-01-21 15:03:21.720
python: least-squares estimation?
I know how to implement least-squares with elementary matrix decomposition and other operations, but how can I do it in Python? (I've never tried to use matrices in Python) (clarification edit to satisfy the shoot-first-and-ask-questions-later -1'er) I was looking for help to find out how to use numerical programming ...
Have a look at SciPy. It's got matrix operations.
0.135221
false
2
1,636
2012-01-21 15:03:21.720
python: least-squares estimation?
I know how to implement least-squares with elementary matrix decomposition and other operations, but how can I do it in Python? (I've never tried to use matrices in Python) (clarification edit to satisfy the shoot-first-and-ask-questions-later -1'er) I was looking for help to find out how to use numerical programming ...
scipy and numpy is the obvious way to go here. Note that numpy uses the famous (and well-optimized) BLAS libraries, so it is also very fast. Much faster than any "pure python" will ever be.
1.2
true
2
1,636
2012-01-22 19:31:36.067
Get away from an object in a 2D-grid
I'm developing a small game in python. I am using a 2D rectangular grid. I know that for pathfinding I can use A* and the likes, I know how this works, but the problem I have is a bit different. Let's say we have a computer controlled human and some computer controlled zombies. When the human spots a zombie, it should ...
You could suppose that the zombies can see everything within a particular range (radius or perhaps be more clever) and then have the human look for a spot that he thinks the zombies can't see. Pick the closest spot the zombie can't see and use the A* algorithm to find a path if one exists, else try a different one. Loo...
1.2
true
2
1,637
2012-01-22 19:31:36.067
Get away from an object in a 2D-grid
I'm developing a small game in python. I am using a 2D rectangular grid. I know that for pathfinding I can use A* and the likes, I know how this works, but the problem I have is a bit different. Let's say we have a computer controlled human and some computer controlled zombies. When the human spots a zombie, it should ...
Just off the top of my head, you'll probably be able to do some vector math and have the human run in the normal vector to the zombies. I don't know how well this will work (or how it will scale to the number of zombies you have), but you could do something like: For each zombie, compute the distance to the human and...
0
false
2
1,637
2012-01-23 08:35:01.870
Python serialization - Why pickle?
I understood that Python pickling is a way to 'store' a Python Object in a way that does respect Object programming - different from an output written in txt file or DB. Do you have more details or references on the following points: where are pickled objects 'stored'? why is pickling preserving object representation...
I find it to be particularly useful with large and complex custom classes. In a particular example I'm thinking of, "Gathering" the information (from a database) to create the class was already half the battle. Then that information stored in the class might be altered at runtime by the user. You could have another gro...
0
false
1
1,638
2012-01-23 11:12:39.657
How do you restrict large file uploads in wsgi?
I'm trying to get an understanding of the best way of handling file uploads safely in a wsgi app. It seems a lot of solutions involve using FieldStorage from the cgi module to parse form data. From what I understand about FieldStorage it performs a bit of 'magic' behind the scenes by streaming data into a tempfile. Wha...
It would depend on your front-end server. If it has any configuration to block big request even before it goes into your app, use it. If you want to block this with your code I see two approaches: Look ate the Content-Length HTTP Header. If it's bigger than you can handle, deny the request right away. Don't trust the ...
1.2
true
1
1,639
2012-01-23 11:47:51.100
url-enabled access to ressources with pyramid
I'm setting up a pyramid application where access to ressources can be shared across registered users. I would also like to give access to non-members, using non-trivial links to files or directories. While I see how to do this for registered members, I'm not sure how to do this with anonymous users. Do I need to crea...
If you've figured out how to do this for authenticated users, it should be obvious how to do it for anonymous users as well. They will have the pyramid.security.Everyone principal, which you can use in your ACLs to assign various permissions. Route factories will allow you to assign custom ACLs to individual routes. Th...
1.2
true
1
1,640
2012-01-24 15:22:25.107
ctypes - does python need to be compiled with same version as C library?
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. ...
There's no requirement at all that the native library that you call with ctypes has to be built with a matching runtime. In fact there's not even a requirement that the native library even uses a C runtime. For example you can use ctypes to call code written in other languages, e.g. Delphi. Or you can use ctypes to cal...
1.2
true
2
1,641
2012-01-24 15:22:25.107
ctypes - does python need to be compiled with same version as C library?
I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. ...
CPython doesn't contain C++ code and thus there is no requirement with regards to the C++ compiler used to compile a C++ library loaded into a CPython process. However, the C layer and the C++ library must generally be compiled with the same C++ compiler. And if the C++ library or the C layer link against libpython, ...
0
false
2
1,641
2012-01-25 07:16:21.320
Bug output feature class
I just encounter a little bug, maybe someone can help me. I'm creating Thiessen Polygons. I define my shapefile in Input Features, and in Output Feature Class, then I have to possibilities either keep the default file or save my output where I want. When I save my output in the Default file, and then I open the attrib...
Saving the output in a file geodatabase (which is probably what your default output location is) will create a feature class, which by default adds the shape_length and shape_area columns. Saving the output into a regular folder will create a shapefile, which does not create these fields by default. If your python sc...
0
false
1
1,642
2012-01-25 17:45:36.940
Parallel fetching of files
In order to download files, I'm creating a urlopen object (urllib2 class) and reading it in chunks. I would like to connect to the server several times and download the file in six different sessions. Doing that, the download speed should get faster. Many download managers have this feature. I thought about specifying ...
As we've been talking already I made such one using PycURL. The one, and only one, thing I had to do was pycurl_instance.setopt(pycurl_instance.NOSIGNAL, 1) to prevent crashes. I did use APScheduler to fire requests in the separate threads. Thanks to your advices of changing busy waiting while True: pass to while True:...
0.386912
false
1
1,643
2012-01-26 14:52:49.420
Finding 'edge cases' in a dataset
i apologize in advance for not being very precise, as a i dont know the mathematical expression for what i want. i am using matplotlib to analyze a large dataset. What i have now is a distribution of x,y points. I want to find out the cases in which the x values of my function are the same, but y differs the greatest....
I think what you want is a variance plot. Create a dictionary for distinct x values. Put each distinct value of y in a list associated with each x. Find the stdev (np.std) of the list associated with each x say "s". Plot the s vs. x.
0.201295
false
1
1,644
2012-01-27 01:25:23.073
How to register an event for when a user has a new tweet?
I am looking through the Tweepy API and not quite sure how to find the event to register for when a user either send or receives a new tweet. I looked into the Streaming API but it seems like that is only sampling the Twitter fire house and not really meant for looking at one indvidual user. What I am trying to do is...
I used the .filter function then filtered for the user I was looking for.
1.2
true
2
1,645
2012-01-27 01:25:23.073
How to register an event for when a user has a new tweet?
I am looking through the Tweepy API and not quite sure how to find the event to register for when a user either send or receives a new tweet. I looked into the Streaming API but it seems like that is only sampling the Twitter fire house and not really meant for looking at one indvidual user. What I am trying to do is...
I don't think there is any event based pub-sub exposed by twitter. You just have to do the long polling.
0.135221
false
2
1,645
2012-01-27 14:31:02.807
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
I have no idea why python run every script in a new command window. For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback. Python 2.7 32-bit at the same machine works normally
You can run it through IDLE, the built-in editor. It may not be much helpful if you have to provide command-line args. An alternate option may be making the code wait for a keypress using raw_input(), as Insidi0us said. You can also print the errors to a file. Another option may be running the command prompt first, the...
0
false
2
1,646
2012-01-27 14:31:02.807
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
I have no idea why python run every script in a new command window. For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback. Python 2.7 32-bit at the same machine works normally
Did you try adding raw_input() at the end of testfile.py ?
0
false
2
1,646
2012-01-27 16:26:04.283
OpenOPC using Python
I am trying to do some stuff with siemens PLC using OPENOPC using python. I am wondering how I will get OPC server that I can communicate using PYOPC. Is there any open OPC server available or am I not understanding some of the key concepts here? Since I am a newbie, I hope to get some down-to-earth suggestions.
You can install some tryout opc servers. google opc simulation. The python OpenOPC client is what i try to use. My problems was that I did not have a plc on my desk. You need a plc on your desk connected to your actual siemens s7 engineering station to have the siemens opc server show the tags in the plc.
1.2
true
1
1,647
2012-01-27 18:52:38.700
How to import a java class i created in jython and call a method
I have made a java class that calls other java classes and then prints to a screen. i am trying to build a python interface that calls my java class, runs the one method within it, and terminates. i cannot get access to my method. i have used the line "import directory.directory2.myClass.java (and .jar and .class) i ma...
Jython supports loading Java classes as if they were Python modules. It searches the directories in sys.path for .class files. First, make sure your Java class has already been compiled with javac. Then, do a sys.path.append(d), where d is the directory containing the package. So if your class says package foo.bar; at ...
1.2
true
1
1,648
2012-01-27 21:57:37.617
convert a String '\u05d9\u05d7\u05e4\u05d9\u05dd' to its unicode character in python
I get a Json object from a URL which has values in the form like above: title:'\u05d9\u05d7\u05e4\u05d9\u05dd' I need to print these values as readable text however I'm not able to convert them as they are taken as literal strings and not unicode objects. doing unicode(myStr) does not work doing a = u'%s' % myStr does ...
You should use the json module to load the JSON data into a Python object. It will take care of this for you, and you'll have Unicode strings. Then you can encode them to match your output device, and print them.
0.496174
false
1
1,649
2012-01-28 14:16:50.017
Fitted curve on chart using ReportLab
I'm preparing a set of reports using open source ReportLab. The reports contain a number of charts. Everything works well so far. I've been asked to take a (working) bar chart that shows two series of data and overlay a fitted curve for each series. I can see how I could overlay a segmented line on the bar graph by c...
I would recommend using MatPlotLib. This is exactly the sort of thing it's designed to handle and it will be much easier than trying to piece together something in ReportLab alone, especially since you'll have to do all the calculation of the line on your own and figure out the details of how to draw it in just the ri...
1.2
true
1
1,650
2012-01-28 14:21:55.647
How to know on what page number flowable was placed during rendering a pdf with reportlab
How to determine on what page(need a page number) will be each flowable after rendering to pdf. I was thinking to add a custom id attribute to flowable, so i will know what flowable is it. But how can i determine on what page it will be placed? What is the best way to achieve this?
At what point do you need this information? It becomes available as the document is constructed, so you can get it after rendering by overriding methods such as afterPage, afterDrawPage, and afterFlowable. You can then get the page number from the DocTemplate class (I believe there's a class variable called something...
0.386912
false
1
1,651
2012-01-28 20:52:07.943
{% url %} not work in Django
I have a problem using the tag {% url%} in Django on GAE, I found the problem applying internationalization in JavaScript files, writing: {% url django.views.i18n.javascript_catalog %} Django throws the error: TemplateSyntaxError at / view / test / Caught ImproperlyConfigured while rendering: Error Importing data st...
There is an earlier error that you did not yet fix: Error Importing data store piston.gae_store OAuth: "No module named piston.gae_store" This does not seem to be related to the lines that you change. It will probably even occur when your remove the {% url ...%} completely, right? Try to fix the existing error first.
0
false
1
1,652
2012-01-30 15:04:10.770
How to automate python logging
I need to add logging to a milter that I wrote a few months back. It is occasionally rejecting some messages, but I'm not sure why. I know how to add logging to a Python script from the HowTo, but is it necessary for me to add log output commands at every point in my script, or is there a way Python automatically han...
If you have no idea where it fails you could run a debugging session with input that you know causes the error, and step through the code if that is an option. Another pretty obvious option is to log all exceptions at the entrance of your script and then drill down from there, but I honestly don't think that there is a...
0.673066
false
1
1,653
2012-02-01 05:31:46.920
Data structures with Python
Python has a lot of convenient data structures (lists, tuples, dicts, sets, etc) which can be used to make other 'conventional' data structures (Eg, I can use a Python list to create a stack and a collections.dequeue to make a queue, dicts to make trees and graphs, etc). There are even third-party data structures that ...
Given that all data structures exist in memory, and memory is effectively just a list (array)... there is no data structure that couldn't be expressed in terms of the basic Python data structures (with appropriate code to interact with them).
0
false
1
1,654
2012-02-01 12:27:32.827
how to pickle wx.frame(python GUI) object and unpickle it?
how to pickle wx.frame(python GUI) object and unpickle it?
Instead of pickling the object, pickle the necessary attributes of the object required to reconstruct a new instance of the object.
0.201295
false
1
1,655
2012-02-01 16:34:37.533
converting NavigableString to unicode string
When I run the following code: if substr in movie.lowercase: I get the following error AttributeError: 'NavigableString' object has no attribute 'lowercase' movie is from here: movie = row.td.div.h4.string I tried to change it to (without success) movie = row.td.div.h4.string.string or movie = unicode(row.td.div.h4.str...
There should not be any problem just using python's str() method on the navigable string object you have. From my experience with NavigableString's they are already in unicode so if you want a string on which .lower will work then you need to cast it to a python string (UTF-8) then recast it back to unicode.
0
false
1
1,656
2012-02-03 08:56:58.900
How to call subclass methods in a superclass in Python
I want to know how to call subclass methods in the superclass.
The point behind a subclass is that it extends and alters the behaviour of the superclass. The superclass can't know how a subclass will extend it. Edit: But it is well possible that the superclass knows, that the subclass will extend it. Not sure, if this is good design, though.
0.625929
false
1
1,657
2012-02-03 19:38:15.797
Access Gmail Imap with OAuth 2.0 Access token
I am using Google's Oauth 2.0 to get the user's access_token, but I dont know how to use it with imaplib to access inbox.
IMAP does not support accessing inbox without password -> so imaplib doesnt
-0.101688
false
1
1,658
2012-02-05 11:17:06.160
How to reference creator object in Python?
I have a question. There are two classes: A and B. A creates object of type B. So from A, it is easy to access methods of B, but how can I access methods of object A from object B? I am trying to use bidirectional signal-slot mechanism in Qt. A can easily have a slot for a signal in B, but B cannot see signals in A. I ...
There's no way to do this automatically. You'll just have to give each B a reference to A when you create it, something like b_instance.parent = a_instance.
0
false
1
1,659
2012-02-07 04:38:02.410
Only allow a subset of users to access a google app project
We are trying to develop a project in google app engine for a senior project, and its set up in such a way that only a subset of user at our college should be able to login to it. Our college uses google domains for email, so that is currently out login requirement (a college email though google that is), but how can ...
Wouldn't it be easier to write a user model rather than access it with the Google accounts API? That way you could define user groups and access without having to rely on Google. The Google Accounts API in the example is really for low-level init debugging.
1.2
true
1
1,660
2012-02-07 09:28:36.507
Python 'theory' - constructing a multifunction program - how to plan a basic flow
I've written a few little things in python, and I am ramping up to build something a little more challenging. The last project I made basically ingested some text files, did some regex over each file and structured the data in an useful way so I could investigate some data I have. I found it quite tough near the end ...
(1) It is possible to write a fine programme in a single .py file (2) In any style of programming, it is always (apart from special, hardware-driven cases) best to break your code up into short functions (or methods) that accomplish a discrete task. (3) Experienced programmers will frequent write their code one way, d...
1.2
true
2
1,661
2012-02-07 09:28:36.507
Python 'theory' - constructing a multifunction program - how to plan a basic flow
I've written a few little things in python, and I am ramping up to build something a little more challenging. The last project I made basically ingested some text files, did some regex over each file and structured the data in an useful way so I could investigate some data I have. I found it quite tough near the end ...
Others have suggested studying other experienced programmers' code from open source projects, etc. and from tutorials and textbooks, which is sound advice. Sometimes a similar example is all you need to set you on the right path. I also suggest to use your own frustration and experience as feedback to help yourself im...
0.386912
false
2
1,661
2012-02-07 23:09:05.063
In Python, what's the method for returning only the max odd integer in a list?
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
Have a look at 'filter' built-in function
0.058243
false
3
1,662
2012-02-07 23:09:05.063
In Python, what's the method for returning only the max odd integer in a list?
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
numbers = [] while True: try: num = int(input('Enter the number: ')) if num == 0: break else: numbers.append(num) except: print('Not a valid digit') odd = [i for i in numbers if i % 2 != 0] if odd: print('The largest odd number is: ', max(odd)) else: ...
-0.029146
false
3
1,662
2012-02-07 23:09:05.063
In Python, what's the method for returning only the max odd integer in a list?
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
The easiest approach is to separate the problem into subproblems. You can safely ignore every even number, so you have to be able to identify even numbers, you have to ignore numbers that satisfy the condition of being even and on the result - a list of odd numbers - you just have to find the highest number. So, find o...
0
false
3
1,662
2012-02-08 03:42:51.433
Cloud Computing Passing a Function to Server
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
Well if you wrote it locally you probably wont be executing anything that require compilation in realtime (I assume your looking for efficiency and will be exchanging a whole series of computations in the cloud) which in that case you looking to send it something like a ruby file on the fly? But that doesn't seem very ...
0
false
3
1,663
2012-02-08 03:42:51.433
Cloud Computing Passing a Function to Server
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
One of the most popular systems for processing large amounts of data in a cluster is Hadoop (http://hadoop.apache.org/) You can write functions in python using the MapReduce programming pattern (google it), upload your program to the cluster, and it will process your data. Take a look and read up. It's a huge topic - t...
0.135221
false
3
1,663
2012-02-08 03:42:51.433
Cloud Computing Passing a Function to Server
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
Code mobility is a largely unexplored field with more questions than answers. Generally you cannot move arbitrary code around at runtime. There are a few programming languages that historically supported code mobility (e.g. Kali Scheme), but it is not something that would be ready for main stream use. Concerning functi...
0
false
3
1,663
2012-02-08 08:23:16.480
Overloading a part of or entire Django app for a specific User
I am developing a large Django site where some of the users are going to have specific needs. So I am looking for a way to overload part of a Django app if the user meets specific conditions. I would prefer to be able to dynamically load a user tailored version of an app, instead of loading the standard app all togethe...
In short, you can't (or, at least, it would be fairly tricky and magical). In longer: apart from performing the checks in the apps themselves, you might want to consider creating a router app which handles the requests, then decides which sub-app should be responsible for them. If you can give some more details, it wou...
0
false
1
1,664
2012-02-08 16:44:09.320
Python: Two packages with the same name; how do you specify which is loaded?
I have two packages that install different packages with the same name. They are both "packages" in that they have top-level setup.py files which specify package=['foo'] in the setup command. If I install using distutils.core, the last to be installed overwrites the previous one (but I think wouldn't overwrite unless ...
I think the best way to workaround, would be to change the name of the toplevel directory, unless other packages depend on that package. You can do this by altering the setup.py or just change the name folder in site-packages directly. The egg is just meta data. As far as setting sys.path, it's better to use the site m...
0
false
1
1,665
2012-02-09 06:56:25.610
getting python 2.4.5 out of my environment variables
major noob question: when I run python on the windows command line, it says I have 2.4.5... however, it's not in my PATH environment variable (or anywhere in my environment variables), and, Python27 IS in PATH! Anyone know how I can get Python27 up and running in windows cmd?
Trying running WHERE PYTHON (or WHERE PYTHON.EXE) to figure out where the python executable is at. It may be that python v2.4.5 is as part of another program.
0
false
1
1,666
2012-02-09 14:09:37.520
Update Gedit side panel
I'm writing my first gedit plugin, a directory browser for the sidebar. Show sidepanel with content of the cwd. self._side_widget = self.get_dir() #returns a Gtk.Treestore obj self.side_panel = self.window.get_side_panel() self.side_panel.add_item(self._side_widget, "dir-browser", "Directory Browser", None) self.sid...
Either empty the current tree store and fill it again from the new directory, or call set_model(new_treestore) on the tree view widget. It will update itself.
1.2
true
1
1,667
2012-02-09 19:49:20.037
how to install additional python packages with pythonbrew
I am using pythonbrew to install 2.7.2 on my CentOS. It has worked before but this time on a separate clean system I am running into an issue. After installing pythonbrew (which I had to --force since it complained in make test about distutils) I switched to 2.7.2 When I run easy_install setuptools it tries to go sys...
Finally I just ditched pythonbrew and did a multi install of python. Thereafter I used bash and profile to switch between my python environments.
1.2
true
1
1,668