Q_Id
int64
2.93k
49.7M
CreationDate
stringlengths
23
23
Users Score
int64
-10
437
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
DISCREPANCY
int64
0
1
Tags
stringlengths
6
90
ERRORS
int64
0
1
A_Id
int64
2.98k
72.5M
API_CHANGE
int64
0
1
AnswerCount
int64
1
42
REVIEW
int64
0
1
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
15
5.1k
Available Count
int64
1
17
Q_Score
int64
0
3.67k
Data Science and Machine Learning
int64
0
1
DOCUMENTATION
int64
0
1
Question
stringlengths
25
6.53k
Title
stringlengths
11
148
CONCEPTUAL
int64
0
1
Score
float64
-1
1.2
API_USAGE
int64
1
1
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
15
3.72M
8,779,159
2012-01-08T16:29:00.000
1
0
0
0
0
php,python,facebook,api,facebook-graph-api
0
8,781,271
0
1
0
true
1
0
1) Nope. 2) Yes, you can use the Graph API and HTTP Get me/feed?until={date}
1
4
0
0
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 anything about changing the privacy settings of posts, or even searching for posts made in a specific date range. So here is the information that I want: Is it possible to change privacy settings for OLD posts via the Graph API? Is it possible to search the Graph API for posts in a particular date range? Preferably before 31st December 2010. If it is possible, how do you do it!?
Changing privacy of old Facebook posts using the Graph API
1
1.2
1
0
1
740
8,790,555
2012-01-09T15:12:00.000
1
0
0
1
0
python,colors,hex,x11,rgb
0
8,791,192
0
4
0
false
0
0
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.
2
2
0
0
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 do this in Python.
Convert HTML HEX Color or RGB tuple to X11 color
0
0.049958
1
0
0
2,309
8,790,555
2012-01-09T15:12:00.000
1
0
0
1
0
python,colors,hex,x11,rgb
0
8,791,219
0
4
0
false
0
0
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 color table. As an example, color 15 on one terminal may be #ff0000, but #33ff33 on another. There really isn't a conversion between the two.
2
2
0
0
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 do this in Python.
Convert HTML HEX Color or RGB tuple to X11 color
0
0.049958
1
0
0
2,309
8,792,044
2012-01-09T16:50:00.000
13
0
1
1
0
python,python-idle
0
34,907,888
0
10
0
false
0
0
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 to roll your own: You'll need to know the terminal command to open your version of IDLE. On my Mac right now (early 2016), running python 2.7.10, it is "idle2.7" Using spotlight, or in the Utilities folder, open "Automator" Choose an "Application" type document. Make sure "Actions" is selected in the gray bar, upper left. In the actions column, find "Run Shell Script" and double-click it, or drag it to the workflow area on the right. Enter the terminal command in the parameters box that appears. Save your automation (I called mine "IDLE" and put it in the Applications folder, to make it easy). It's now available (as soon as spotlight indexes it) via all the normal methods. The only side-effect will be that while it's running, your menu bar will have a spinning gear over in the tray area next to the clock. This indicates an automation workflow is running. Once you close IDLE, it will go away.
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
1
1
0
0
100,963
8,792,044
2012-01-09T16:50:00.000
2
0
1
1
0
python,python-idle
0
45,255,372
0
10
0
false
0
0
first to launch the terminal CMD+space second to input idle3 the idle will be activated automatically.
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
0.039979
1
0
0
100,963
8,792,044
2012-01-09T16:50:00.000
63
0
1
1
0
python,python-idle
0
8,792,311
0
10
0
true
0
0
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 launch /usr/bin/idle for you (an exercise left to the reader).
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
1.2
1
0
0
100,963
8,792,044
2012-01-09T16:50:00.000
0
0
1
1
0
python,python-idle
0
32,878,774
0
10
0
false
0
0
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).
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
0
1
0
0
100,963
8,792,044
2012-01-09T16:50:00.000
1
0
1
1
0
python,python-idle
0
32,877,359
0
10
0
false
0
0
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 "Run", click "Run Module" (or, F5). Assuming no errors, the results will appear in the Shell window. Edit your file & repeat as necessary.
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
0.019997
1
0
0
100,963
8,792,044
2012-01-09T16:50:00.000
1
0
1
1
0
python,python-idle
0
35,586,250
0
10
0
false
0
0
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
6
46
0
0
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.
how do I launch IDLE, the development environment for Python, on Mac OS 10.7?
0
0.019997
1
0
0
100,963
8,793,702
2012-01-09T19:02:00.000
2
0
1
0
0
python,icr
0
8,793,854
0
3
0
false
0
0
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 to get your hands on a scanner first, and only then can you use python to read through the data.
1
3
0
0
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 software that spit out the responses. Edit clarification: I am inquiring about what I need to do after the paper has been digitized. I want to write some code that looks at an image file and recognizes which box has been marked in and outputs a representation of the respondents answers. I would be looking at a page scanned from a desktop scanner or something similar.
any Python tools for reading Scantron-style data
1
0.132549
1
0
0
2,785
8,793,877
2012-01-09T19:17:00.000
1
0
1
0
0
python,django,virtualenv,pip
0
43,931,969
0
5
0
false
0
0
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/
3
34
0
0
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
how to copy modules from one virtualenv to another
0
0.039979
1
0
0
31,912
8,793,877
2012-01-09T19:17:00.000
0
0
1
0
0
python,django,virtualenv,pip
0
69,423,767
0
5
0
false
0
0
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/Lib/site-packages.
3
34
0
0
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
how to copy modules from one virtualenv to another
0
0
1
0
0
31,912
8,793,877
2012-01-09T19:17:00.000
1
0
1
0
0
python,django,virtualenv,pip
0
8,794,087
0
5
0
false
0
0
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.
3
34
0
0
Is it possibe to copy python modules from one virtualenv to another.If so how is this done?
how to copy modules from one virtualenv to another
0
0.039979
1
0
0
31,912
8,796,565
2012-01-09T23:18:00.000
2
0
1
0
0
python,types
0
8,796,638
0
2
0
false
0
0
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"
1
1
0
0
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? I know about and practice TDD.
When coding in Python, how do I achieve guarantees of correctness similar to those I get with Haskell's type system?
0
0.197375
1
0
0
497
8,796,800
2012-01-09T23:46:00.000
14
1
1
0
0
python,serial-port,pyserial
0
8,808,218
0
3
0
true
0
0
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.
3
10
0
0
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 fact my current form of this program has a thread dedicated to reading/writing on the serial port and I use thread-safe data structures to coordinate activities in the app. My app would benefit greatly if I could write to the serial port from the main thread (and never read from it), and read from the serial port using blocking reads in the second thread (and never write to it). If someone really wants me to go into why this would benefit the app I can add my reasons. In my mind there would be just one instance of Serial() and even while thread B sits in a blocking read on the Serial object, thread A would be safe to use write methods on the Serial object. Anyone know whether the Serial class can be used this way? EDIT: It occurs to me that the answer may be platform-dependent. If you have any experience with a platform like this, it'd be good to know which platform you were working on. EDIT: There's only been one response but if anyone else has tried this, please leave a response with your experience.
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
0
1.2
1
0
0
10,755
8,796,800
2012-01-09T23:46:00.000
0
1
1
0
0
python,serial-port,pyserial
0
14,660,364
0
3
0
false
0
0
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 the serial port. If the size/frequency of the messages is low, a simple shared buffer for the message itself and a flag to indicate that a new message is present would work. If you need higher performance, you should use a stack. This is actually implemented simply using an array large enough to accumulate many message to be sent and two pointers. The write pointer is updated only by Thread A. The read pointer is updated only by Thread B. Thread B would grab the message and sent it to the serial port. The serial port should use the timeout feature so that the read serial port function release the CPU, allowing you to poll the shared buffer and, if any new message is present, send it to the serial port. I would use a sleep at that point to limit the CPU time used by Thread B.. Then, you can make Thread B loop to the read serial port function. If the serial port timeout is not working right, like if the USB-RS232 cable get unplugged, the sleep function will make the difference between a good Python code versus the not so good one.
3
10
0
0
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 fact my current form of this program has a thread dedicated to reading/writing on the serial port and I use thread-safe data structures to coordinate activities in the app. My app would benefit greatly if I could write to the serial port from the main thread (and never read from it), and read from the serial port using blocking reads in the second thread (and never write to it). If someone really wants me to go into why this would benefit the app I can add my reasons. In my mind there would be just one instance of Serial() and even while thread B sits in a blocking read on the Serial object, thread A would be safe to use write methods on the Serial object. Anyone know whether the Serial class can be used this way? EDIT: It occurs to me that the answer may be platform-dependent. If you have any experience with a platform like this, it'd be good to know which platform you were working on. EDIT: There's only been one response but if anyone else has tried this, please leave a response with your experience.
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
0
0
1
0
0
10,755
8,796,800
2012-01-09T23:46:00.000
4
1
1
0
0
python,serial-port,pyserial
0
8,814,172
0
3
0
false
0
0
I've used pyserial in this way on Linux (and Windows), no problems !
3
10
0
0
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 fact my current form of this program has a thread dedicated to reading/writing on the serial port and I use thread-safe data structures to coordinate activities in the app. My app would benefit greatly if I could write to the serial port from the main thread (and never read from it), and read from the serial port using blocking reads in the second thread (and never write to it). If someone really wants me to go into why this would benefit the app I can add my reasons. In my mind there would be just one instance of Serial() and even while thread B sits in a blocking read on the Serial object, thread A would be safe to use write methods on the Serial object. Anyone know whether the Serial class can be used this way? EDIT: It occurs to me that the answer may be platform-dependent. If you have any experience with a platform like this, it'd be good to know which platform you were working on. EDIT: There's only been one response but if anyone else has tried this, please leave a response with your experience.
pyserial - possible to write to serial port from thread a, do blocking reads from thread b?
0
0.26052
1
0
0
10,755
8,808,476
2012-01-10T18:27:00.000
1
1
0
0
0
python,thrift
0
8,826,673
0
2
1
false
0
0
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).
2
5
0
0
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 example? Will it support persistent connections? Thanks in advance.
how to deploy a hardened Thrift server for python?
0
0.099668
1
0
0
1,005
8,808,476
2012-01-10T18:27:00.000
1
1
0
0
0
python,thrift
0
17,220,313
0
2
1
false
0
0
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 care about performance. If you read through this code a bit, you'll find that it is fairly easy to re-implement it using a different HTTP server of your choosing. There are a number of good options in the Python ecosystem. 2) Also if you read the code, you'll find that Thrift HTTP servers are regular old HTTP servers. They accept all traffic on a single path ('/' by default) and direct the message to the appropriate method by reading routing information encoded into the message itself (using the Thrift "processor" construct). You should be able to set up Apache/nginx/whatever in the normal way and simply forward all traffic to '/' on the host and port you are running on.
2
5
0
0
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 example? Will it support persistent connections? Thanks in advance.
how to deploy a hardened Thrift server for python?
0
0.099668
1
0
0
1,005
8,823,830
2012-01-11T17:29:00.000
0
0
1
0
0
ipython
0
8,825,937
0
1
0
true
0
0
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 throughput without unreasonable long-term growth.
1
0
0
0
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, after 10 hours running, I find that ipcontroller has used 3.1 GB memory. I do use MultiEngineClient.clear_properties(). But it never releases any memory. Does anyone know how to release the memory of ipcontroller ?
Huge memory usage by ipcontroller
0
1.2
1
0
0
345
8,823,924
2012-01-11T17:36:00.000
4
0
0
0
0
python,emacs,docstring,pep8,autoformatting
0
8,827,727
0
4
0
false
0
0
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.
1
14
0
0
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?
In emacs Python mode, how do I set a different auto-fill width for docstrings and code?
1
0.197375
1
0
0
2,249
8,826,688
2012-01-11T21:11:00.000
2
0
0
0
0
python,pyqt,pyqt4,editing,qtablewidget
0
8,948,046
0
2
0
false
0
1
You can also use setCurrentCell. table.setCurrentCell(0,1) QTableWidget.setCurrentCell (self, int row, int column)
1
2
0
0
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 editing by default when window is created?
QTableWidget how to have a cell selected for editing from code and/or with single click
0
0.197375
1
0
0
3,799
8,827,703
2012-01-11T22:33:00.000
7
0
1
0
0
python,algorithm,theory
0
8,827,797
0
4
0
true
0
0
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. Each bot will keep track on how many games it would have won if it played, and how many it would have lost. One of these bots will be the random attacker. Each time it is your turn: choose which bot won so far the most [greedy] - and use it. Using this approach you are guaranteed to be at the top median of your class! [with enough rounds of games of course]
2
10
0
0
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 order to defy attacks. Am I going in a right direction? Any ideas?
Rock paper Scissors bot algorithm
1
1.2
1
0
0
6,603
8,827,703
2012-01-11T22:33:00.000
0
0
1
0
0
python,algorithm,theory
0
8,827,880
0
4
0
false
0
0
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 track the source anymore), suppose that you could let several bots running (if not, cooperate with some of your classmates to run this strategy). Let's say you have 4 bots A,B,C,D Imagine each bot play 100 times against the others. Let your B,C,D bots play for the first let's say 10 times play a strategy that would let recognise it as a bot from your team, say 'RPPSPPSSRS', let your A bot play some other strategy that would let it be recognized by the bots B,C,D. Then, in the next 90 round let the bots B,C,D lose ('paper') to the A and play random against the others. Let the bot A win ('scissors') from the B,C,D and play random against the others. Thus, the bot A gets a huge advantage.
2
10
0
0
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 order to defy attacks. Am I going in a right direction? Any ideas?
Rock paper Scissors bot algorithm
1
0
1
0
0
6,603
8,840,127
2012-01-12T18:15:00.000
0
0
0
0
0
python,opencv,face-detection,simplecv
0
33,917,789
0
2
0
false
0
0
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.
1
5
1
0
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 appearance models but I'm having trouble understanding how to use this with python and I don't have enough context to figure out if this is even the conventional method for detecting different parts of the lips. Is that my best choice or do I have other options? If I should use it, how would I get started with it using python and simplecv?
OpenCV Lip Segmentation
0
0
1
0
0
4,301
8,845,456
2012-01-13T03:15:00.000
2
0
1
0
0
python,elementtree
0
8,848,549
0
3
0
true
0
0
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 be easy if your target is a root sub-element (just call getroot()) otherwise you'll have to find it.
1
6
0
0
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?
How can i do replace a child element(s) in ElementTree
0
1.2
1
0
1
6,654
8,858,306
2012-01-13T22:47:00.000
0
1
0
0
0
python,hp-quality-center
0
13,123,269
0
1
0
false
0
0
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 externally to connect to QC and execute your tests and also update run results. there is lot of documentation available on QC help for OTA-API
1
0
0
0
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 new testcase, the testcase is pre-populated with a Default Python Script. I wish to know how I can modify that Base Default Python Script so that the future new testcases will have my default Python Script? Is there any way to do the same through OTA API? Thanks, Amit
Quality Center VAPI-XP-TEST - Modify Default Python Script
0
0
1
0
0
2,376
8,858,946
2012-01-14T00:11:00.000
0
0
0
0
0
python
0
8,858,983
0
4
0
false
0
0
str.split() without any arguments will split by any length of whitespace. operator.itemgetter() takes multiple arguments, and will return a tuple.
1
5
1
0
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 Algorithm |Date |Time |Longitude |Latitude |Country 1 2000-01-03 215926.688 -0.262 35.813 Algeria 1 2000-01-03 215926.828 -0.284 35.817 Algeria Here is what I want in the end: Longitude,Latitude,Country,Date,Time -0.262,35.813,Algeria,2000-01-03,215926.688 Any tips on how to approach this?
converting a space delimited file to a CSV
0
0
1
0
0
18,146
8,859,532
2012-01-14T01:57:00.000
4
1
0
0
0
python,mongodb,heroku,mlab
0
8,859,701
0
5
0
false
1
0
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:[email protected]:27707/db Simply the info from the uri in python by creating a connection from the uri string.
1
3
0
0
The documentation only talks about how to do it from ruby.
How can I use the mongolab add-on to Heroku from python?
0
0.158649
1
0
0
6,640
8,864,599
2012-01-14T19:03:00.000
0
0
0
0
0
python,netcdf
0
9,473,690
0
7
0
false
0
0
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.
1
6
1
0
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
Convert netcdf to image
0
0
1
0
0
8,951
8,873,219
2012-01-15T20:43:00.000
3
0
0
0
0
python,image,pygame
0
8,873,270
0
4
0
false
0
1
After using blit or any other update on your drawing surface, you have to call pygame.display.flip() to actually update what is displayed.
1
16
0
0
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.
What is a good way to draw images using pygame?
1
0.148885
1
0
0
36,330
8,878,210
2012-01-16T09:50:00.000
1
0
1
0
0
python,virtualenv,pip
1
10,285,156
1
1
0
true
0
0
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
0
0
0
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 version number). For some reason I cannot figure out, since yesterday, it fails to upgrade the packages. No error is reported, the files are just not changed. Now I'm sure I'm doing something differently but I can't explain the change in behaviour. I can upgrade the package with the -U --no-deps flags, but this technique forces the deployment script to differentiate between first install and upgrades (--no-deps is required as otherwise dependencies would be downloaded each time from pypi). Any ideas how I can get a single pip command to do installs and upgrades?
Python package won't upgrade
1
1.2
1
0
0
227
8,879,102
2012-01-16T11:04:00.000
0
1
0
0
0
python,git,aptana
0
8,897,929
0
1
0
false
0
0
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
1
0
0
0
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 top of the App explorer window. I can't see anyway to turn Python off. I have also been trying to get Git to behave, and (away from Aptana) have been making changes to TortoiseGit and installing SmartGit. Any ideas? (Specifically, can I turn off Python somehow to see if this helps?)
Aptana has started crashing - possibly due to Python or Git
0
0
1
0
0
308
8,888,567
2012-01-17T01:19:00.000
51
0
1
0
0
python,regex
0
8,888,615
0
4
0
true
0
0
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-compiled regex objects, of course) However, that will be inefficient compared to combining your regexes in a single expression. If this code is time- or CPU-critical, you should try instead to compose a single regular expression that encompasses all your needs, using the special | regex operator to separate the original expressions. A simple way to combine all the regexes is to use the string join method: re.match("|".join([regex_str1, regex_str2, regex_str2]), line) A warning about combining the regexes in this way: It can result in wrong expressions if the original ones already do make use of the | operator.
2
28
0
0
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.
Match a line with multiple regex using Python
0
1.2
1
0
0
55,780
8,888,567
2012-01-17T01:19:00.000
7
0
1
0
0
python,regex
0
8,888,619
0
4
0
false
0
0
Try this new regex: (regex1)|(regex2)|(regex3). This will match a line with any of the 3 regexs in it.
2
28
0
0
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.
Match a line with multiple regex using Python
0
1
1
0
0
55,780
8,906,265
2012-01-18T06:48:00.000
1
0
1
0
0
python,design-patterns
0
8,908,454
0
2
0
true
0
0
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 clashes in your cfg-file, you can do the same in your global collection.
1
0
0
0
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 parameters as appropriate to the next layer of objects, and so on in each layer. But the only objects themselves know which parameters they need, so the controller object would need to learn a lot of detail about every other object. The other choice is to bundle all the parameters into a collection, and pass the whole collection into every function call (equivalently, create a global object that stores them, and is accessible to everyone). This looks and feels ugly, and would cause a variety of minor technical issues (e.g., I can't allow two objects to use parameters with the same name; etc.) What to do?
how to make a lot of parameters available to the entire system?
0
1.2
1
0
0
83
8,909,342
2012-01-18T11:29:00.000
0
0
0
0
0
python,xlrd
0
43,124,531
0
4
0
false
0
0
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.
1
9
0
0
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 is in the cell is a string i get something like text:u'MyName' and i only want to keep the string 'MyName'; if what is in the cell is a number i get something like number:201.0 and i only want to keep the integer 201. If anyone can indicate me what i should to only extract the value, formatted as i want, thank you.
Python xlrd : how to convert an extracted value?
0
0
1
1
0
27,320
8,912,327
2012-01-18T15:03:00.000
1
0
1
0
0
python,user-interface
0
8,913,722
0
10
0
false
0
1
If you're more into gaming you can use PyGame for GUIs.
2
23
0
1
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't have python on it. I have already made an executable but I would much rather use a gui just because of the more "polished" look it has.
How to make a gui in python
0
0.019997
1
0
0
104,449
8,912,327
2012-01-18T15:03:00.000
0
0
1
0
0
python,user-interface
0
8,912,460
0
10
0
false
0
1
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 order to distribute the entire python environment with your app. Also have a look at PySide or PyQt. They have a ton of tutorials everywhere and heavy documentation from Qt.
2
23
0
1
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't have python on it. I have already made an executable but I would much rather use a gui just because of the more "polished" look it has.
How to make a gui in python
0
0
1
0
0
104,449
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
71,692,901
0
34
0
false
0
0
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
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
4
0
1
1
0
python,virtualenv
0
62,498,657
0
34
0
false
0
0
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
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.023525
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
65,636,990
0
34
0
false
0
0
If you are using windows, just run .\Scripts\activate. Mind that the backslash plays the trick!
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
-1
0
1
1
0
python,virtualenv
0
71,559,922
0
34
0
false
0
0
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.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
-0.005882
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
1
0
1
1
0
python,virtualenv
0
71,215,993
0
34
0
false
0
0
The steps for activating virtualenv using Python3 on windows are: python3 -m venv env .\env\bin\activate
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.005882
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
60,413,441
0
34
0
false
0
0
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
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
2
0
1
1
0
python,virtualenv
0
67,224,356
0
34
0
false
0
0
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
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.011764
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
71,382,806
0
34
0
false
0
0
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
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
71,376,740
0
34
0
false
0
0
Use These it worked for meenv\Scripts\activate
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
59,298,771
0
34
0
false
0
0
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.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
21
0
1
1
0
python,virtualenv
0
47,483,536
0
34
0
false
0
0
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 virtual environment. It will look something like this (venv)user@host:~/venv$. And your venv is activated now.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
1
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
61,607,988
0
34
0
false
0
0
Navigate to your virtualenv folder eg ..\project1_env> Then type source scripts/activate eg ..\project1_env>source scripts/activate
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
61,962,316
0
34
0
false
0
0
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 there.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
2
0
1
1
0
python,virtualenv
0
25,353,183
0
34
0
false
0
0
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 virtualenv (.env).
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.011764
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
2
0
1
1
0
python,virtualenv
0
48,840,058
0
34
0
false
0
0
You can run the source command on cygwin terminal
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.011764
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
1
0
1
1
0
python,virtualenv
0
53,059,234
0
34
0
false
0
0
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.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0.005882
1
0
0
352,338
8,921,188
2012-01-19T04:54:00.000
0
0
1
1
0
python,virtualenv
0
58,090,444
0
34
0
false
0
0
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.
17
190
0
0
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 might just have to do with my system path, but not sure what to point it to (I do know how to edit the path). I'm on python 7 / windows os, virtual env 2.2.x Processing dependencies for virtualenv Finished processing dependencies for virtualenv c:\testdjangoproj\mysite>virtualenv --no-site-packages venv The --no-site-packages flag is deprecated; it is now the default behavior. Using real prefix 'C:\\Program Files (x86)\\Python' New python executable in venv\Scripts\python.exe File venv\Lib\distutils\distutils.cfg exists with different content; not overwri ting Installing setuptools.................done. Installing pip...................done. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source venv/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>source mysite/bin/activate 'source' is not recognized as an internal or external command, operable program or batch file. c:\testdjangoproj\mysite>
Issue with virtualenv - cannot activate
0
0
1
0
0
352,338
8,935,191
2012-01-20T00:08:00.000
1
0
0
0
0
python,security,amazon-s3
0
8,935,272
0
3
0
false
0
0
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 expert, so I won't suggest a specific alternative, but I would suggest using something that is designed to produce crypto-quailty random data, and transform that into something that can be used as an S3 key (I'm not sure what the requirements on S3 key data might be, but I'd guess they're supposed to be something like a filename). To be honest, having no security other than an unguessable name still leaves me with a bad feeling. It seems to easy to have an unintentional leak of the names, as Ian Clelland suggests in his comment.
1
1
0
0
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.
Sending 'secure' financial statements on S3
0
0.066568
1
1
0
260
8,953,991
2012-01-21T15:03:00.000
2
0
0
0
0
python,matrix,numerical-methods
0
8,954,018
0
3
0
true
0
0
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.
2
0
1
1
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 in Python. Looks like numpy and scipy are the way to go. I was looking for how to use them, but I found a tutorial.
python: least-squares estimation?
0
1.2
1
0
0
819
8,953,991
2012-01-21T15:03:00.000
1
0
0
0
0
python,matrix,numerical-methods
0
8,954,011
0
3
0
false
0
0
Have a look at SciPy. It's got matrix operations.
2
0
1
1
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 in Python. Looks like numpy and scipy are the way to go. I was looking for how to use them, but I found a tutorial.
python: least-squares estimation?
0
0.066568
1
0
0
819
8,963,987
2012-01-22T19:31:00.000
1
0
0
0
0
python,dijkstra,path-finding,a-star
0
8,964,029
0
2
0
true
0
0
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. Look out when there's nowhere to run. Alternatively you could weight all of the spots in your visibility region with a value based on how far away you would be from the zombies if you chose that spot.
2
0
0
0
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 get away from this as far as he can. At the moment, to test everything I just turn around 180° and run away, until I spot another zombie and repeat. Obviously this is not very smart (and can cause problems if there is a zombie on both sides). I was wondering if there was a smarter way to do this? Something like using Dijkstra to find a "safe zone" where I can run to? Alternatives are always welcome, I can't seem to figure it out.
Get away from an object in a 2D-grid
0
1.2
1
0
0
239
8,963,987
2012-01-22T19:31:00.000
0
0
0
0
0
python,dijkstra,path-finding,a-star
0
8,964,083
0
2
0
false
0
0
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 the direction it is from the human. Create a vector for each zombie (or some subset of the close zombies), using the direction and the inverse of the distance, since the closer the zombie is the more important it is to run away. Find the sum of all the vectors. Make the human run in the normal vector to your result. I'm not sure how resource intensive this would be, but it seems like the most logical way to prioritize where to run.
2
0
0
0
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 get away from this as far as he can. At the moment, to test everything I just turn around 180° and run away, until I spot another zombie and repeat. Obviously this is not very smart (and can cause problems if there is a zombie on both sides). I was wondering if there was a smarter way to do this? Something like using Dijkstra to find a "safe zone" where I can run to? Alternatives are always welcome, I can't seem to figure it out.
Get away from an object in a 2D-grid
0
0
1
0
0
239
8,968,884
2012-01-23T08:35:00.000
0
0
1
0
0
python,serialization,pickle
0
55,150,034
0
4
0
false
0
0
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 group of tables in the database and write another function to go through everything stored and write it to the new database tables. Then you would need to write another function to be able to load something saved by reading all of that info back in. Alternatively, you could pickle the whole class as is and then store that to a single field in the database. Then when you go to load it back, it will all load back in at once as it was before. This can end up saving a lot of time and code when saving and retrieving complicated classes.
1
98
0
0
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 more than, say, storing in DB? can I retrieve pickled objects from one Python shell session to another? do you have significant examples when serialization is useful? does serialization with pickle imply data 'compression'? In other words, I am looking for a doc on pickling - Python.doc explains how to implement pickle but seems not dive into details about use and necessity of serialization.
Python serialization - Why pickle?
1
0
1
0
0
53,631
8,970,713
2012-01-23T11:12:00.000
3
0
0
0
0
python,http,wsgi,webob
0
8,975,702
0
2
1
true
1
0
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 headers and start reading the request body, until you reach your limit. Note that this is not a very clever way, but could work. =) Trusting the HTTP header could lead you to some problems. Supose some one send a request with a Content-Length: 1024 but sends a 1GB request body. If your front-end server trusts the header, it will start do read this request and would find out later that the request body is actually much bigger that it should be. This situation could still fill your server disk, even being a request that "passes" the "too big check". Although this could happen, I think trusting the Header would be a good start point.
1
5
0
0
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. What I'm not 100% clear on is how to restrict a request containing a file greater than a specified amount (say 10MB). If someone uploads a file which is several GB in size you obviously want to block the request before it chews through your server's disk space right? What is the best way to restrict file uploads in a wsgi application?
How do you restrict large file uploads in wsgi?
0
1.2
1
0
0
1,729
8,971,115
2012-01-23T11:47:00.000
2
1
0
0
0
python,session,authorization,pyramid
0
8,973,728
0
1
0
true
1
0
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. They simply override the default root factory on the Configurator.
1
0
0
0
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 create an unprotected view and perform security checks myself ? Maybe a better way would be to append access rights to users sessions using cookies? Can route factories help me for this purpose? Any other way?
url-enabled access to ressources with pyramid
0
1.2
1
0
0
88
8,989,328
2012-01-24T15:22:00.000
0
0
1
1
0
python,ctypes
0
8,989,530
0
2
0
false
0
1
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, they must be compiled against the same version of CPython that is later used to run the ctypes code that loads the library.
2
2
0
0
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. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
ctypes - does python need to be compiled with same version as C library?
0
0
1
0
0
337
8,989,328
2012-01-24T15:22:00.000
4
0
1
1
0
python,ctypes
0
8,989,579
0
2
0
true
0
1
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 call Windows API functions which are not linked against MSVC. I guess you'll have to look elsewhere to resolve your problem!
2
2
0
0
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. I'm wondering if there is any restriction on whether the Python interpreter and the C++ code need to be compiled with the same version of the C++ compiler? If so, how do I find out what c++ was used to build Python? I've tried to run strings on Python and grep for gcc and g++, nothing shows up.
ctypes - does python need to be compiled with same version as C library?
0
1.2
1
0
0
337
8,999,047
2012-01-25T07:16:00.000
0
0
0
0
0
python,arcmap
0
10,212,782
0
2
0
false
0
0
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 script requires you to place your outputs in different places and in different formats, you could check to see if your output will be into a regular folder, and thus a shapefile, and add the two fields accordingly, then calculate them. This is not a bug, it's a format thing.
1
0
0
0
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 attribute table of the Polygon file created, I can observe the Shape_length field and the Shape_Area field. But if I save my file in another file (Output Feature Class), then I don't find the Shape_length field and the Shape_Area field in my attribute table.. I have no idea how to change that? because I'm running a small loop using Python and I'd like to have the Area for each Polygon in the table rather than having to recalculate it for each file created ! cheers
Bug output feature class
0
0
1
0
0
172
9,007,456
2012-01-25T17:45:00.000
3
0
1
0
0
python,http,asynchronous,urllib2,urllib
0
13,502,466
0
3
0
false
0
0
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: time.sleep(3) in the main thread the code behaves quite nice and usage of Runner module from python-daemon package application is almost ready to be used as a typical UN*X daemon.
1
6
0
0
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 the part of file i would like to download in each session, and somehow process all the sessions in the same time. I'm not sure how I can achieve this.
Parallel fetching of files
0
0.197375
1
0
1
10,489
9,019,949
2012-01-26T14:52:00.000
1
0
0
0
0
python,statistics,matplotlib
0
9,020,306
0
2
0
false
0
0
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.
1
2
1
0
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. So if i plot it, one part of the cases is at the top of my graph, the other is the botton of the graph. So how do i get the points(x,y), (x,y') where f(x)=y and f(x)=y' and y-y'=max ? cheers
Finding 'edge cases' in a dataset
0
0.099668
1
0
0
960
9,027,884
2012-01-27T01:25:00.000
1
1
0
0
0
python,twitter,twitter-oauth,tweepy
0
9,056,152
0
3
0
true
0
0
I used the .filter function then filtered for the user I was looking for.
2
0
0
0
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 have my program update whenever something happens to the user. Essentially what a user would see if they were in their account on the twitter homepage. So my question is: What is the method or event I should be looking for in the Tweepy API to make this happen?
How to register an event for when a user has a new tweet?
0
1.2
1
0
1
183
9,027,884
2012-01-27T01:25:00.000
1
1
0
0
0
python,twitter,twitter-oauth,tweepy
0
9,028,060
0
3
0
false
0
0
I don't think there is any event based pub-sub exposed by twitter. You just have to do the long polling.
2
0
0
0
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 have my program update whenever something happens to the user. Essentially what a user would see if they were in their account on the twitter homepage. So my question is: What is the method or event I should be looking for in the Tweepy API to make this happen?
How to register an event for when a user has a new tweet?
0
0.066568
1
0
1
183
9,034,799
2012-01-27T14:31:00.000
0
0
1
1
0
python,cmd
0
9,034,986
0
3
0
false
0
0
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, then run python command (make sure your environment variable contains the python installation directory).
2
1
0
0
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
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
0
0
1
0
0
390
9,034,799
2012-01-27T14:31:00.000
0
0
1
1
0
python,cmd
0
9,034,871
0
3
0
false
0
0
Did you try adding raw_input() at the end of testfile.py ?
2
1
0
0
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
Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit)
0
0
1
0
0
390
9,036,653
2012-01-27T16:26:00.000
0
0
0
0
0
python,ole,opc
0
9,213,366
0
2
0
true
0
0
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
0
0
0
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.
OpenOPC using Python
0
1.2
1
0
0
2,203
9,038,505
2012-01-27T18:52:00.000
3
0
1
0
0
java,python,jython
0
9,047,483
0
2
0
true
1
0
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 the top, and resides at mydir/foo/bar/myclass.java, then you must have mydir in sys.path (NOT one of the subdirs of mydir). Finally, import the class via something like from foo.bar import myclass. The names between must match up between Python and Java! You'll be doing "from [package] import [class]".
1
2
0
0
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 made the .jar file from both the raw code and from the .class file. none of these seem to be working. i set sys.path.append to point to the directory where the java files are. Do i need to convert my java class file to a python module? and if so how do i do that?
How to import a java class i created in jython and call a method
0
1.2
1
0
0
5,286
9,040,618
2012-01-27T21:57:00.000
4
0
1
0
1
python,string,json,unicode
0
9,040,643
0
3
0
false
0
0
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.
1
2
0
0
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 not work all are escaped as string so return the same sequence of characters. Does any one know how I can do this conversion in python? May be the right approach is to change the encoding of the response, how do I do that?
convert a String '\u05d9\u05d7\u05e4\u05d9\u05dd' to its unicode character in python
0
0.26052
1
0
0
1,062
9,045,888
2012-01-28T14:16:00.000
1
0
0
0
0
python,charts,reportlab,curve-fitting
0
9,046,880
0
1
0
true
0
0
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 right place. MatPlotLib integrates easily with ReportLab; I've used the combination several times with great results.
1
0
1
0
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 creating both a line chart and bar chart in the same ReportLab drawing. I can't find any reference for fitted curves in ReportLab, however. Does anyone have any insight into plotting a fitted curve to a series of data in ReportLab or, failing that, a suggestion about how to accomplish this task (I'm thinking that chart would need to be produced in matplotlib instead)?
Fitted curve on chart using ReportLab
0
1.2
1
0
0
447
9,045,937
2012-01-28T14:21:00.000
2
0
0
0
0
python,pdf,reportlab
0
9,046,943
0
2
1
false
0
0
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 like _currentPage, but you'll need to check the ReportLab code since I don't think it's documented).
1
2
0
0
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?
How to know on what page number flowable was placed during rendering a pdf with reportlab
0
0.197375
1
0
0
1,281
9,048,513
2012-01-28T20:52:00.000
0
0
0
0
0
python,django,google-app-engine,internationalization,django-templates
1
9,054,738
0
2
0
false
1
0
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.
1
1
0
0
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 store piston.gae_store OAuth: "No module named piston.gae_store" And try other parameters: {% url prueba.views.prueba %} I get the same error. If I remove piston throws another error on another package, and if only the URL url.py let me test the latter throws error: 'str' object has no attribute 'resolve' The final url.py: urlpatterns = patterns('', url(r'^view/', include('website.urls')), ) I hope I can help or show another way to get the url of the JavaScript I want without using {% url django.views.i18n.javascript_catalog %}
{% url %} not work in Django
0
0
1
0
0
417
9,065,936
2012-01-30T15:04:00.000
2
1
1
0
0
python,logging
0
9,065,992
0
1
0
false
0
0
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 way that will find the right places to log for you - if this would be the case that program could just as well track the bug down on itself.
1
1
0
0
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 handles that? Basically, I don't know where in the script it fails and don't want to add the overhead of 60 logging lines. I'm looking for the simplest method of doing this.
How to automate python logging
1
0.379949
1
0
0
540
9,091,252
2012-02-01T05:31:00.000
0
0
1
0
0
python,data-structures
0
9,091,268
0
4
0
false
0
0
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).
1
2
1
0
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 can be used for specific tasks (for instance the structures in Pandas, pytables, etc). So, if I know how to use lists, dicts, sets, etc, should I be able to implement any arbitrary data structure if I know what it is supposed to accomplish? In other words, what kind of data structures can the Python data structures not be used for? Thanks
Data structures with Python
1
0
1
0
0
2,410
9,095,796
2012-02-01T12:27:00.000
1
0
0
0
0
python,wxpython,python-2.5
0
9,095,942
0
2
0
false
0
1
Instead of pickling the object, pickle the necessary attributes of the object required to reconstruct a new instance of the object.
1
0
0
0
how to pickle wx.frame(python GUI) object and unpickle it?
how to pickle wx.frame(python GUI) object and unpickle it?
0
0.099668
1
0
0
460
9,099,523
2012-02-01T16:34:00.000
0
0
1
0
0
python,string,unicode,beautifulsoup
1
41,417,621
0
2
0
false
1
0
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.
1
2
0
0
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.string) Do you know how to convert NavigableString to normal unicode string with lowercase method?
converting NavigableString to unicode string
0
0
1
0
0
7,115
9,125,997
2012-02-03T08:56:00.000
9
0
1
0
0
python
0
9,126,238
0
5
0
false
0
0
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.
1
14
0
0
I want to know how to call subclass methods in the superclass.
How to call subclass methods in a superclass in Python
0
1
1
0
0
32,346
9,134,491
2012-02-03T19:38:00.000
-1
1
0
0
0
python,gmail,oauth-2.0,gmail-imap,imaplib
0
11,414,012
0
4
0
false
0
0
IMAP does not support accessing inbox without password -> so imaplib doesnt
1
12
0
0
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.
Access Gmail Imap with OAuth 2.0 Access token
0
-0.049958
1
0
1
6,657
9,148,782
2012-02-05T11:17:00.000
0
0
1
0
0
python,pyqt4,python-2.7
0
9,148,796
0
2
0
false
0
1
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.
1
0
0
0
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 have a vague idea that somehow the creator class can be referenced as a 'member' while an object is being created, but I am not sure how to do code this. Thanks in advance.
How to reference creator object in Python?
0
0
1
0
0
298
9,171,080
2012-02-07T04:38:00.000
1
0
0
1
0
python,google-app-engine
0
9,171,764
0
1
0
true
1
0
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
0
0
0
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 we limit it to not just people without that domain, but a subset or per-approved users with that domain? Also if it matters, within the subset of users, there are four additional types of usesr, who will have access to different pages, functions and information. Right now we are just using the google login APIs, and we are at a loss of how to micro-manage the user pool. Would we have to create a data store entry for each user who should be authorized to access the service and run a check at each page to ensure they have the privileges to be there? Or does google provide some type of service to make this easier that I've missed? Thanks folks!
Only allow a subset of users to access a google app project
1
1.2
1
0
0
122
9,173,794
2012-02-07T09:28:00.000
3
0
1
0
0
python,modularity
0
9,180,449
0
3
1
false
0
0
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 improve. Whenever you find yourself thinking any of the following: It feels like I'm writing the same code over and over again with only small changes I wrote this code myself, but I had to study it for a long time to re-learn how it works Each time I go back and add something to this code it takes me longer to get it working again There's a bug in this code somewhere, but I haven't a clue where Surely somebody somewhere has solved this problem already Why is this taking me so long to get done? That means you have room for improvement in your technique. A lot of the difference between an expert and beginning programmer is the ability to do the following: Don't Repeat Yourself (DRY): Instead of copy-pasting code, or writing the same code over and over with variations, write a single common routine with one or more parameters that can do all of those things. Then call that routine in multiple places. Keep It Simple (KIS): Break up your code into simple well-defined behaviors/routines that make sense on their own, organized into classes/modules/packages, so that each part of the overall program is easy to understand and maintain. Write informative and concise comments, and document the calls even if you don't intend to publish them. Divide & Conquer Testing: Thoroughly test each individual class, function, etc. by itself (preferably with a unit-testing framework) as you develop it, rather than only testing the entire application. Don't Re-invent the Wheel: Use open source frameworks or other tools where possible to solve problems that are general and not specific to your application. In all but the most trivial cases, there is a risk that you do not fully understand the problem and your home-grown solution may be lacking in an important way. Estimate Honestly: Study your own previous efforts to learn how long it takes you to do certain things. Try to work faster next time, but don't assume you will. Measure yourself and use your own experience to estimate future effort. Set expectations and bargain with scope.
2
1
0
1
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 to remember what section operated on what part of the text, especially as the code grew as I 'fixed' things along the way. In my head, I imagine my code to be a series of small interconnected modules - descrete .py files that I can leave to one side knowing what they do, and how they interoperate. The colleague that showed me how to def functions basically meant that I ended up with one really long piece of code that I found really hard to navigate and troubleshoot. (1) Is this the right way? or is there an easier way of making modules that pass variables between them, I think i would find this better, as I could visualise the flow better (mainly becuase its how I was used to working in MATLAB a few years ago I guess) (2) Can you use this method to plan out the various layers of functions before hand to give you a 'map' to write towards? (3) is there any easy to access tutorials for this kind of stuff? I often find the tutorials suddenly jump way over my head.... Thanks.
Python 'theory' - constructing a multifunction program - how to plan a basic flow
1
0.197375
1
0
0
953
9,173,794
2012-02-07T09:28:00.000
4
0
1
0
0
python,modularity
0
9,174,984
0
3
1
true
0
0
(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, discover a problem, either write more code, or different code, and consider whether any of their existing code can be broken out into a separate function. A sign that you need to do this is when you are sequentially assigning to variables to pass data down your function. Never copy-paste your code to another place, even with changes, unless it be to break it out as a function, and replace the original code with a call to that function. (4) In many cases, it can be useful to organise your code into classes and objects, even when it is not technologically necessary to do so. It can help you see that you have defined a complete set of operations (or not) necessary on some collection of data. (5) Programming is actually quite hard. Even among those who have a talent for it, it takes a while to be comfortable. As an illustration, when I was doing my master's degree, I and my (fairly talented) friends all felt only in our final year that we had begun to achieve a degree of facility and competence (and these are all people who had been programming since at least their teenage years). The important thing is to keep learning and improving, rather than repeating the same one or two years of experience over and over. (6) To that end, read books and articles. Try new things. Think.
2
1
0
1
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 to remember what section operated on what part of the text, especially as the code grew as I 'fixed' things along the way. In my head, I imagine my code to be a series of small interconnected modules - descrete .py files that I can leave to one side knowing what they do, and how they interoperate. The colleague that showed me how to def functions basically meant that I ended up with one really long piece of code that I found really hard to navigate and troubleshoot. (1) Is this the right way? or is there an easier way of making modules that pass variables between them, I think i would find this better, as I could visualise the flow better (mainly becuase its how I was used to working in MATLAB a few years ago I guess) (2) Can you use this method to plan out the various layers of functions before hand to give you a 'map' to write towards? (3) is there any easy to access tutorials for this kind of stuff? I often find the tutorials suddenly jump way over my head.... Thanks.
Python 'theory' - constructing a multifunction program - how to plan a basic flow
1
1.2
1
0
0
953
9,185,443
2012-02-07T23:09:00.000
-1
0
1
0
0
python,list
0
53,438,736
0
14
0
false
0
0
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: print('All numbers are even')
3
3
0
0
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[-1].
In Python, what's the method for returning only the max odd integer in a list?
0
-0.014285
1
0
0
4,845
9,185,443
2012-02-07T23:09:00.000
2
0
1
0
0
python,list
0
9,185,488
0
14
0
false
0
0
Have a look at 'filter' built-in function
3
3
0
0
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[-1].
In Python, what's the method for returning only the max odd integer in a list?
0
0.028564
1
0
0
4,845
9,185,443
2012-02-07T23:09:00.000
0
0
1
0
0
python,list
0
9,185,613
0
14
0
false
0
0
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 or implement... ...a function that checks whether a number is even or not. ...a function that filters a list on a condition. ...a function that finds the highest value in a list. Once you've done that you just have to combine the three functions.
3
3
0
0
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[-1].
In Python, what's the method for returning only the max odd integer in a list?
0
0
1
0
0
4,845
9,187,578
2012-02-08T03:42:00.000
1
0
0
1
0
python,cloud
0
9,187,618
0
3
0
false
0
0
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 - too much for one question. If you have some specific use cases please edit your question with more info.
3
0
0
0
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, Anthony Hurst
Cloud Computing Passing a Function to Server
0
0.066568
1
0
0
124
9,187,578
2012-02-08T03:42:00.000
0
0
0
1
0
python,cloud
0
9,187,637
0
3
0
false
0
0
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 practical since you really aren't going to get this newly written function coming from the client side sent over and scaled well across the cluster you are sending it to. That being said, set something up where you can send functions perimeters in the form of xml, json, etc. Use an http connection or an https if you need it secure and build it using hadoop, mpi, et.
3
0
0
0
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, Anthony Hurst
Cloud Computing Passing a Function to Server
0
0
1
0
0
124
9,187,578
2012-02-08T03:42:00.000
0
0
0
1
0
python,cloud
0
9,337,324
0
3
0
false
0
0
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 functions, here I am not quite sure what you are asking. There are functional programming languages that support what I would consider "precursors" to code mobility. E.g. in Erlang you can pass function signatures around and in Cloud Haskell you can send a Closure (that is a function with collocated data) within certain limitations. Other approaches that have reached higher significance are to craft plug-ins, that is precompiled binaries that are loaded at runtime. There might be further possibilities to pass object code around so that not everything has to be compiled and linked at runtime when it is passed from one platform to an other. Generally what needs to be clear to you is that what you develop is source code. This either needs to be interpreted at runtime (means on both platforms there must be an interpreter loaded) or compiled into binaries and then started. Then there is still the question of data and state etc. that would need to be shared before code mobility will work as we envision it.
3
0
0
0
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, Anthony Hurst
Cloud Computing Passing a Function to Server
0
0
1
0
0
124
9,189,795
2012-02-08T08:23:00.000
0
0
0
0
0
python,django
0
9,189,836
0
1
0
false
1
0
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 would be possible to give a more detailed answer.
1
0
0
0
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 together. The idea is all good in theory, but i have no idea how to do this in a clean python/django-esque way, I would also prefer if my urls would remain the same even when an user app is loaded.
Overloading a part of or entire Django app for a specific User
1
0
1
0
0
53
9,197,668
2012-02-08T16:44:00.000
0
0
1
0
0
python,import
0
9,197,871
0
2
0
false
0
0
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 module, by creating a .pth file. When instantiated, any paths located in that file will be added to the "head" of the python path. Are these two packages different and the naming is a coincidence, or are they simply branches of the same?
1
7
0
0
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 the .py files all had the same names?). If I install using setuptools, the two packages get installed into different eggs. One option would be to explicitly set sys.path before importing the package name; this seems "un-pythonic" and rather dirty. Assuming I have these two identically named packages installed in different eggs from setuptools, how do I specify which is imported?
Python: Two packages with the same name; how do you specify which is loaded?
0
0
1
0
0
4,345
9,206,627
2012-02-09T06:56:00.000
0
0
1
1
0
python
0
12,851,137
0
1
0
false
0
0
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.
1
1
0
0
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?
getting python 2.4.5 out of my environment variables
0
0
1
0
0
104
9,212,350
2012-02-09T14:09:00.000
1
0
0
0
0
python,pygtk,gedit,pygobject
0
9,213,736
0
1
0
true
0
1
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
0
0
0
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.side_panel.activate_item(self._side_widget) With a double click on a file, i open the document in gedit. With a double click on a directory I change the directory and I want to update the content of the side panel. I can build the a new treestore from the current working directory with self.get_dir() but I don't know how to update self.side_panel.
Update Gedit side panel
0
1.2
1
0
0
543
9,217,687
2012-02-09T19:49:00.000
0
0
0
1
1
python,pythonbrew
0
9,245,490
0
1
0
true
0
0
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
0
0
0
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 system python (2.5). Since I am non superuser this ofcourse failed. What am I missing here?
how to install additional python packages with pythonbrew
0
1.2
1
0
0
399