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
19,085,887
2013-09-30T03:07:00.000
0
0
1
0
1
python,module,wrapper,argparse
0
19,086,137
0
3
0
false
0
0
Provided that you are calling third-party modules, a possible solution is to change sys.argv and sys.argc at runtime to reflect the correct parameters for the module you're calling, once you're done with your own parameters.
1
2
0
0
I searched and tried following stuff but could not found any solution, please let me know if this is possible: I am trying to develop a python module as wrapper where I call another 3rd party module with its .main() and provide the required parameter which I need to get from command line in my module. I need few parameter for my module too. I am using argparse to parse command line for calling module and my module. The calling parameter list is huge (more than 40) which are optional but may require anytime who will use my module. Currently I have declared few important parameters in my module to parse but I need to expand with all the parameter. I thought of providing all the parameter in my module without declaring in add_argument. I tried with parse_known_args which also require declaration of all parameter is required. Is there any way where I can pass on all parameter to calling module without declaring in my module? If its possible please let me know how it can be done. Thanks in advance,
Call another module with passing its command line parameter from my module using argparse in python
1
0
1
0
0
2,494
19,086,885
2013-09-30T05:17:00.000
0
0
0
0
0
python,sql,web-applications,flask
1
19,087,185
0
2
0
false
1
0
You can use SQLAlchemy.It's a plug-in
1
1
0
0
I'm a complete beginner to Flask and I'm starting to play around with making web apps. I have a hard figuring out how to enforce unique user names. I'm thinking about how to do this in SQL, maybe with something like user_name text unique on conflict fail, but then how to I catch the error back in Python? Alternatively, is there a way to manage this that's built in to Flask?
How do I enforce unique user names in Flask?
1
0
1
1
0
1,118
19,104,798
2013-09-30T22:12:00.000
6
0
1
1
0
python,file,output
0
19,105,021
0
1
0
true
0
0
There are two points at which your file can buffer - Python's internal buffers and the buffers on the operating system. This is a performance boost that avoids system calls and disk writes while the buffer is filling up. Calling file.flush() will push the internal buffer to the operating system. You can additionally call fsync to request the operating system to save to disk. Usually you can leave the operating system to do what it knows best, so calling flush is usually enough for most applications. The same is partially true for Python's internal buffer - it knows best in terms of performance, but you may require more frequent writes and be willing to pay the additional cost. The only way to know the exact cost is to measure it both ways.
1
3
0
0
I thought writing a file gives real-time output, since it is so when I use C/C++ to write files. But when I run python program it seems the output file is always 0 byte until the whole program finished running. Even for the nohup python xxx.py &, the print stuff in the file nohup.out isn't realtime, and can only be seen after execution. I'm now running really big program and want to see the progress in the file, how can I achieve it?
Why I do not see realtime output in the output file?
0
1.2
1
0
0
2,279
19,120,229
2013-10-01T15:30:00.000
1
0
0
1
1
python,wing-ide
0
19,120,750
0
1
0
true
0
0
The location of the python.exe for Python 3.3 can vary depending on how you installed it. Probably the best bet is to search w/ Spotlight for python.exe, press "Show All" in the drop down menu, change to "File Name" instead of "Contents" search and then click on results to see the full path at the bottom of the search results window. You'll get at least 2-3 results and the full path should make clear which is the correct one. Then enter that into Python Executable in the Configure Python dialog, accessed from the Source menu in Wing 101. You'll need to restart the Python Shell in Wing 101 from its Options menu before it switches to the new Python version.
1
2
0
0
I am relatively new to programming, and I am using Wing101 version: 5.0.0-b8 (rev 29847). The Python Shell within Wing101, is version 2.7.2, how do I configure it to open python 3.3.2. I have downloaded Python 3.3.2 and I need the custom Python Executable. I previously tried "/usr/bin/python" as my custom python executable, but it doesn't work. I am on a Mac 10.8.3
Wing101 - Configure python 3.3.2 from 2.7.2 on a mac
0
1.2
1
0
0
10,844
19,128,188
2013-10-02T00:31:00.000
0
0
0
0
0
android,python,appium
0
19,128,261
0
3
0
false
0
1
A simple VM emulate an Android device. Not dificult.
2
0
0
0
I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out
What is the android activity for opening sudoku and how do I find how to?
0
0
1
0
0
103
19,128,188
2013-10-02T00:31:00.000
0
0
0
0
0
android,python,appium
0
51,240,166
0
3
0
true
0
1
You just need to run adb shell command in command prompt. After that , Open the Suduko app in your device(make sure your device is connected to your laptop/pc) and go back to the command prompt and run the below command : dumpsys window windows | grep -E 'mCurrentFocus' The Above command will give you the package name & activity name of the currently focused app.
2
0
0
0
I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out
What is the android activity for opening sudoku and how do I find how to?
0
1.2
1
0
0
103
19,130,630
2013-10-02T05:40:00.000
2
0
0
0
0
python,django,django-templates,django-cms
0
19,136,318
0
2
0
true
1
0
As you've seen, you can't truncate a placeholder, as a placeholder's job is simply to render content plugins that are added to it. Your only viable option is to truncate the field in the render template of the plugin, or to add a separate field on your model that can store the truncated text. Such a field could be populated automatically using a post_save signal handler.
1
0
0
0
I'm creating my own Django CMS blog plugin. I'm using a placeholder to hold the full content of the blog entry and I'm trying to figure out how to automatically create an excerpt from this placeholder. If it were simply a text field I know I could use "|truncatechars:15" in the template, but I don't know how to do this for a placeholder. Is there something I can use in the template or in the 'views.py' in order to truncate the placeholder? Thanks in advance.
Truncate Django CMS Placeholder
0
1.2
1
0
0
321
19,191,509
2013-10-04T22:04:00.000
0
0
1
0
0
python,function,project,output
0
19,191,612
0
3
0
false
0
0
You will need an algorithm, which separates your input string by whitespaces. Then you would take the last of those separated strings and add it to your output string. You will have to add a comma, if more names are following. After that, take the other strings, starting with the first one, and check if they are already in the form "[A-Z].". If not, transform them to that form. Otherwise just add them to your output. Thats it. I could be more precise, but you asked not to be :)
2
0
0
0
This question is for a school project so don't give my exact answer XD But please tell me how I would start it. I have been trying it for a couple of hours but I just can't get it. Here is the question: Create a function in python that accepts names in standard form and prints them in the form: E.g. INPUT to OUTPUT Santa Claus to Claus, S. Michael J. Fox to Fox, M. J. Madonna to Madonna William Henry Richard Charles Windsor to Windsor, W. H. R. C.
I need help on creating a name changing program
0
0
1
0
0
44
19,191,509
2013-10-04T22:04:00.000
0
0
1
0
0
python,function,project,output
0
19,191,615
0
3
0
false
0
0
Ok, then use String.Split() To change String into List , then use len() to count the elements. Use loop for and create new string .
2
0
0
0
This question is for a school project so don't give my exact answer XD But please tell me how I would start it. I have been trying it for a couple of hours but I just can't get it. Here is the question: Create a function in python that accepts names in standard form and prints them in the form: E.g. INPUT to OUTPUT Santa Claus to Claus, S. Michael J. Fox to Fox, M. J. Madonna to Madonna William Henry Richard Charles Windsor to Windsor, W. H. R. C.
I need help on creating a name changing program
0
0
1
0
0
44
19,203,395
2013-10-05T22:29:00.000
0
0
0
0
0
python,django
0
19,231,096
0
1
0
true
1
0
If your user is already logged in with a username a password you simply need to allow them to follow the same steps they would when signing up with a social account and that social account will be automatically associated with their django account
1
1
0
0
I'm currently trying to add an 'associate google account' button to my django 1.4.8 project. I've never worked with python-social-auth before, and I'm a bit confused about only associating accounts --as opposed to authenticating against--, and how to use credentials for accessing Google Drive services. Thanks! A.
Python social auth account association only
0
1.2
1
0
0
325
19,207,019
2013-10-06T08:44:00.000
29
0
1
0
0
python,windows,pycharm
0
19,213,327
0
3
0
true
0
0
UPDATE Starting with version 4.0 there's an option Show command line afterwards (renamed in later versions to Run with Python console) when editing run/debug configuration in Run|Edit Configurations.... From output of python --help: -i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x To set interpreter option in PyCharm go to Run|Edit Configuration
3
26
0
0
In PyCharm, after I run a script it automatically kills it: C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py Process finished with exit code 0 How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the >>> prompt after the script runs once through? PyCharm Community Edition 3.0 Windows 7 Python 2.7
Interacting with program after execution
0
1.2
1
0
0
17,624
19,207,019
2013-10-06T08:44:00.000
37
0
1
0
0
python,windows,pycharm
0
27,978,591
0
3
0
false
0
0
in Pycharm, Run/Debug menu choose Edit Configuration, check the box before 'Show command line afterwards'
3
26
0
0
In PyCharm, after I run a script it automatically kills it: C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py Process finished with exit code 0 How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the >>> prompt after the script runs once through? PyCharm Community Edition 3.0 Windows 7 Python 2.7
Interacting with program after execution
0
1
1
0
0
17,624
19,207,019
2013-10-06T08:44:00.000
8
0
1
0
0
python,windows,pycharm
0
50,508,341
0
3
0
false
0
0
Click Run -> Edit Configurations..., Then check the box Run with Python console.
3
26
0
0
In PyCharm, after I run a script it automatically kills it: C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py Process finished with exit code 0 How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the >>> prompt after the script runs once through? PyCharm Community Edition 3.0 Windows 7 Python 2.7
Interacting with program after execution
0
1
1
0
0
17,624
19,220,726
2013-10-07T09:03:00.000
2
0
1
0
0
python,cad,opencascade
0
19,221,047
0
1
0
false
0
0
It looks like pythonOCC do not currently support .3dm files you can either output from Rhino in another format, (sub-optimal in your post), or find/write/sponsor the writing of a .3dm importer for pythonOCC.
1
0
0
0
In the pythonOCC examples CADViewerMDI.py the CAD format step, stp, iges, igs, and brep are suported. Do pythonOCC support the format ".3dm" and if, how do I load it. Supoptimal sulution: Change the format in rhino to one of the other formats.
pythonocc loading .3md format
0
0.379949
1
0
0
182
19,223,411
2013-10-07T11:16:00.000
5
0
1
1
0
python,linux,macos,cython
0
19,223,474
0
1
0
false
0
0
You can't. You'll have to compile a different library for each platform you need to support.
1
2
0
0
I compiled a module.pyx file to module.so under Mac OS X, and now I can use it with: from module import method1 However, the same .so file won't work on Linux, I have to compile a new module.so under Linux. So the problem is, how can I write a cross platform(Mac and Linux) module with Cython?
How to load Cython compiled .so file on both Mac OS X and Linux?
0
0.761594
1
0
0
1,310
19,231,985
2013-10-07T18:29:00.000
0
0
0
0
0
javascript,python,html
0
19,233,083
0
2
0
false
1
0
Keep track of the url of each page you scraped. One way would be to save it with the full URL as a filename. Then, you can resolve relative urls as per the HTML spec.
1
1
0
0
What are some methods to make relative urls absolute in scraped content so that the scraped html appears like the original and css are not broken? I found out <base> tag may help. But how can I find out what the original base of the URL is? I don't care about interactions with the links, but do want them to appear correct. Assume a site 'example.com/blog/new/i.html' i scrape that has 2 resources < link src="/style/style.css" > < link src="newstyle.css" >. Now if i set base as 'example.com/blog/new/i.html' wont the first one break
How best to handle relative urls in scraped content?
0
0
1
0
1
358
19,233,132
2013-10-07T19:37:00.000
11
0
0
1
1
python,multithreading,process,load-balancing,uwsgi
1
19,326,373
0
2
0
true
1
0
So, the solution is: Upgrade uWSGI to recent stable version (as roberto suggested). Use --thunder-lock option. Now I'm running with 50 threads per process and all requests are distributed between processes equally.
2
14
0
0
I've installed Nginx + uWSGI + Django on a VDS with 3 CPU cores. uWSGI is configured for 6 processes and 5 threads per process. Now I want to tell uWSGI to use processes for load balancing until all processes are busy, and then to use threads if needed. It seems uWSGI prefer threads, and I have not found any config option to change this behaviour. First process takes over 100% CPU time, second one takes about 20%, and another processes are mostly not used. Our site receives 40 r/s. Actually even having 3 processes without threads is anough to handle all requests usually. But request processing hangs from time to time for various reasons like locked shared resources, etc. In such cases we have -1 process. Users don't like to wait and click the link again and again. As a result all processes hangs and all users have to wait. I'd add even more threads to make the server more robust. But the problem is probably python GIL. Threads wan't use all CPU cores. So multiple processes work much better for load balancing. But threads may help a lot in case of locked shared resources and i/o wait delays. A process may do much work while one of it's thread is locked. I don't want to decrease time limits until there is no another solution. It is possible to solve this problem with threads in theory, and I don't want to show error messages to user or to make him waiting on every request until there is no another choice.
How to tell uWSGI to prefer processes to threads for load balancing
1
1.2
1
0
0
9,291
19,233,132
2013-10-07T19:37:00.000
9
0
0
1
1
python,multithreading,process,load-balancing,uwsgi
1
19,238,645
0
2
0
false
1
0
Every process is effectively a thread, as threads are execution contexts of the same process. For such a reason there is nothing like "a process executes it instead of a thread". Even without threads your process has 1 execution context (a thread). What i would investigate is why you get (perceived) poor performances when using multiple threads per process. Are you sure you are using a stable (with solid threading support) uWSGI release ? (1.4.x or 1.9.x) Have you thought about dynamically spawning more processes when the server is overloaded ? Check the uWSGI cheaper modes, there are various algorithm available. Maybe one will fit your situation. The GIL is not a problem for you, as from what you describe the problem is the lack of threads for managing new requests (even if from your numbers it looks you may have a too much heavy lock contention on something else)
2
14
0
0
I've installed Nginx + uWSGI + Django on a VDS with 3 CPU cores. uWSGI is configured for 6 processes and 5 threads per process. Now I want to tell uWSGI to use processes for load balancing until all processes are busy, and then to use threads if needed. It seems uWSGI prefer threads, and I have not found any config option to change this behaviour. First process takes over 100% CPU time, second one takes about 20%, and another processes are mostly not used. Our site receives 40 r/s. Actually even having 3 processes without threads is anough to handle all requests usually. But request processing hangs from time to time for various reasons like locked shared resources, etc. In such cases we have -1 process. Users don't like to wait and click the link again and again. As a result all processes hangs and all users have to wait. I'd add even more threads to make the server more robust. But the problem is probably python GIL. Threads wan't use all CPU cores. So multiple processes work much better for load balancing. But threads may help a lot in case of locked shared resources and i/o wait delays. A process may do much work while one of it's thread is locked. I don't want to decrease time limits until there is no another solution. It is possible to solve this problem with threads in theory, and I don't want to show error messages to user or to make him waiting on every request until there is no another choice.
How to tell uWSGI to prefer processes to threads for load balancing
1
1
1
0
0
9,291
19,234,950
2013-10-07T21:17:00.000
0
0
1
0
0
python,list,matrix,linked-list
0
19,235,077
0
2
0
false
0
0
There's more than one way to interpret this, but one option is: Have a single "head" node at the top-left corner and a "tail" node at the bottom-right. There will then be row-head, row-tail, column-head, and column-tail nodes, but these are all accessible from the overall head and tail, so you don't need to keep track of them, and they're already part of the linked matrix, so they don't need to be part of a separate linked list. (Of course a function that builds up an RxC matrix of zeroes will probably have local variables representing the current row's head/tail, but that's not a problem.)
2
0
1
0
I know in a linked list there are a head node and a tail node. Well, for my data structures assignment, we are suppose to create a linked matrix with references to a north, south, east, and west node. I am at a loss of how to implement this. A persistent problem that bothers me is the head node and tail node. The user inputs the number of rows and the number of columns. Should I have multiple head nodes then at the beginning of each row and multiple tail nodes at the end of each row? If so, should I store the multiple head/tail nodes in a list? Thank you.
Linked Matrix Implementation in Python?
0
0
1
0
0
1,333
19,234,950
2013-10-07T21:17:00.000
0
0
1
0
0
python,list,matrix,linked-list
0
19,237,061
0
2
0
false
0
0
It really depends on what options you want/need to efficiently support. For instance, a singly linked list with only a head pointer can be a stack (insert and remove at the head). If you add a tail pointer you can insert at either end, but only remove at the head (stack or queue). A doubly linked list can support insertion or deletion at either end (deque). If you try to implement an operation that your data structure is not designed for you incur an O(N) penalty. So I would start with a single pointer to the (0,0) element and then start working on the operations your instructor asks for. You may find you need additional pointers, you may not. My guess would be that you will be fine with a single head pointer.
2
0
1
0
I know in a linked list there are a head node and a tail node. Well, for my data structures assignment, we are suppose to create a linked matrix with references to a north, south, east, and west node. I am at a loss of how to implement this. A persistent problem that bothers me is the head node and tail node. The user inputs the number of rows and the number of columns. Should I have multiple head nodes then at the beginning of each row and multiple tail nodes at the end of each row? If so, should I store the multiple head/tail nodes in a list? Thank you.
Linked Matrix Implementation in Python?
0
0
1
0
0
1,333
19,238,296
2013-10-08T02:53:00.000
0
0
1
0
0
python,iphone,ios,itunes,itunes-sdk
0
20,518,264
0
1
0
false
0
0
Apple does not offer any APIs to achieve this.
1
0
0
0
I've been using Python to script Win32 iTunes, and it's been rocky but doable. However, I wanted to move beyond just media (songs, etc.) to analyze what apps were on my devices. Can anyone recommend how to use the iTunes Win32 COM interface to, say, get a list of apps that are currently on the phone? I thought the app list might be exposed as a playlist, with each app as an IITFileOrCDTrack, but that doesn't seem to be the case. When I look at my phone as a source, it just lists media playlists (books, movies, etc.) Or, if you can suggest a different way to do this from Python, open to suggestions. I assumed I'd have to use iTunes as my phone is not jailbroken and I don't know any other way to see what's on the phone, but if there is another way, cool. I don't need to add or remove, just want to see what's there. Thanks for any ideas...
Access iOS Apps List in iTunes via Win32 COM?
0
0
1
0
0
133
19,255,537
2013-10-08T18:31:00.000
0
0
1
0
0
python,sorting,python-2.7,dictionary,calendar
0
19,269,052
0
3
0
true
0
0
after a lot of trying i changed my approach and instead of tuples, i used datetime objects and then applied the: months_sorted = sorted(months.iteritems(), key=operator.itemgetter(0))
1
0
0
0
I have a dictionary with entries that are of the format a = dict({(2,2013):[], (2,2011):[], (7,2013):[] , (4,2013):[]}) i want my output to be like this: {(2,2011):[], (2,2013):[], (4,2013):[] , (7,2013):[]} By the way its supposed to be (month,year), how can i achieve that?
sorting dates in key of tuples in dictionary
0
1.2
1
0
0
78
19,256,930
2013-10-08T19:46:00.000
11
0
0
0
0
python,time-series
0
43,874,003
0
5
0
false
0
0
The solutions given are good for a series that aren’t incremental nor decremental(stationary). In financial time series( or any other series with a a bias) the formula given is not right. It should, first be detrended or perform a scaling based in the latest 100-200 samples. And if the time series doesn't come from a normal distribution ( as is the case in finance) there is advisable to apply a non linear function ( a standard CDF funtion for example) to compress the outliers. Aronson and Masters book (Statistically sound Machine Learning for algorithmic trading) uses the following formula ( on 200 day chunks ): V = 100 * N ( 0.5( X -F50)/(F75-F25)) -50 Where: X : data point F50 : mean of the latest 200 points F75 : percentile 75 F25 : Percentile 25 N : normal CDF
2
9
1
0
I have a dataset of time-series examples. I want to calculate the similarity between various time-series examples, however I do not want to take into account differences due to scaling (i.e. I want to look at similarities in the shape of the time-series, not their absolute value). So, to this end, I need a way of normalizing the data. That is, making all of the time-series examples fall between a certain region e.g [0,100]. Can anyone tell me how this can be done in python
Python - how to normalize time-series data
1
1
1
0
0
20,885
19,256,930
2013-10-08T19:46:00.000
0
0
0
0
0
python,time-series
0
21,486,466
0
5
0
false
0
0
I'm not going to give the Python code, but the definition of normalizing, is that for every value (datapoint) you calculate "(value-mean)/stdev". Your values will not fall between 0 and 1 (or 0 and 100) but I don't think that's what you want. You want to compare the variation. Which is what you are left with if you do this.
2
9
1
0
I have a dataset of time-series examples. I want to calculate the similarity between various time-series examples, however I do not want to take into account differences due to scaling (i.e. I want to look at similarities in the shape of the time-series, not their absolute value). So, to this end, I need a way of normalizing the data. That is, making all of the time-series examples fall between a certain region e.g [0,100]. Can anyone tell me how this can be done in python
Python - how to normalize time-series data
1
0
1
0
0
20,885
19,296,422
2013-10-10T12:59:00.000
0
0
0
0
0
java,php,python,actionscript-3,flash
0
19,300,355
0
1
0
false
1
0
GraniteDS will allow you to access your java objects via the Flex framework.
1
0
0
0
Is there anyway I can make a Java application communicate with a Flash Player (application) that is on a website? The flash application is quite dynamic, meaning the data changes as i refresh and visit different pages. In fact the page itself is fully flash. Where should i be looking at to get this working? I'm thinking how can i even retrieve the text / objects from this flash and then send a action(click, text ) . Any advice would be greatly appreciated.
Java Application Interacting with Flash on Web Application
0
0
1
0
0
113
19,310,244
2013-10-11T04:25:00.000
1
0
1
0
0
python,python-2to3
0
20,411,997
0
2
0
false
0
0
You need to run Python, followed by the 2to3 script, followed by tags and arguments. Running 2to3 on command line looks something like this: [python] [2tp3.py] [tags] [files to be converted (can be 1+)] C:\python33\python.exe C:\python33\Tools\Scripts\2to3.py -w C:\Users\watt\Documents\Tom's Stuff\Programs\Python\python 2 test.py By running Python33 followed by 2to3.py, you can run the 2to3 script. Then you add the -w tag to actually convert your program to Python 3. Then you add the files to be converted. The command can be simplified by using changing directory to your Programs folder first.
1
2
0
0
I am fairly new to programming and have been learning python on codecademy. I would like to convert a python 2x program to python 3x using 2to3 on the command line but have no idea how to do it. I have looked at various other questions and articles on how to do it but I still do not understand. I have python 3.3 installed, and am running windows 8. This is the path to my python 2x program and my path to 2to3. My program: "C:\Users\watt\Documents\Tom's Stuff\Programs\Python\python 2 test.py" 2to3 Location: "C:\Python33\Tools\Scripts\2to3.py" Can someone please tell me what I would have to enter into the command line? Thanks in advance...
Using 2to3 python in windows
0
0.099668
1
0
0
2,921
19,340,807
2013-10-13T01:12:00.000
0
0
1
0
0
python,json,netbeans
0
19,340,898
0
2
0
false
1
0
Install Python setuptools sudo apt-get install python-setuptools Now using pip install simplejson sudo pip install simplejson In general most Python packages can be installed this way.
2
0
0
0
I am trying to install simplejson-3.3.1.tar.gz so it can be accessed by my Python project in netbeans IDE 7.3.1. I installed json.py in my src as a quick fix, but need more functionality. I am using linus mint 15 as an OS. I am unsure how to get my modules in netbeans to "see" methors e.g. json.dumps. I am new to netbeans and would appreciate your assistance. Thanks and regards, Chris
How do I install simplejson 3.3.1 for a Python project in Netbeans IDE 7.3.1
0
0
1
0
0
2,016
19,340,807
2013-10-13T01:12:00.000
0
0
1
0
0
python,json,netbeans
0
19,346,510
0
2
0
false
1
0
I found the issue ... netbeans defaults to jython. I had to save my project files to another directory, delete my project (changing to python 2.7. for current project had no effect) and create a new project with netbeans with python 2.7 as the default. Thanks for helping me get simplejson into my python 2.7 Nipun! Chris
2
0
0
0
I am trying to install simplejson-3.3.1.tar.gz so it can be accessed by my Python project in netbeans IDE 7.3.1. I installed json.py in my src as a quick fix, but need more functionality. I am using linus mint 15 as an OS. I am unsure how to get my modules in netbeans to "see" methors e.g. json.dumps. I am new to netbeans and would appreciate your assistance. Thanks and regards, Chris
How do I install simplejson 3.3.1 for a Python project in Netbeans IDE 7.3.1
0
0
1
0
0
2,016
19,361,740
2013-10-14T13:46:00.000
2
1
0
1
0
python,linux,process
0
19,361,844
0
1
0
false
0
0
The information is lost when a process-in-the-middle terminates. So in your situation there is no way to find this out. You can, of course, invent your own infrastructure to store this information at forking time. The middle process (PID 3 in your example) can of course save the information which child PIDs it created (e. g. in a file or by reporting back to the father process (PID 1 in your example) via pipes or similar).
1
1
0
0
How can I find child process pid after the parent process died. I have program that creates child process that continues running after it (the parent) terminates. i.e., I run a program from python script (PID = 2). The script calls program P (PID = 3, PPID = 2) P calls fork(), and now I have another instance of P named P` (PID = 4 and PPID = 3). After P terminates P` PID is 4 and PPID is 1. Assuming that I have the PID of P (3), how can I find the PID of the child P`? Thanks.
How to find orphan process's pid
0
0.379949
1
0
0
947
19,370,567
2013-10-14T22:54:00.000
0
0
0
0
0
python,pygame
0
20,135,822
0
1
0
false
0
0
You could load it all as one image and than draw the different segments onto the screen separately, or even define variables of the segments. This would effectively give you multiple images.
1
0
0
0
I have an image file that has multiple different images on it. I was wondering how to make it so that I can load the individual images from the single one instead of breaking each into its own thing. Sorry if I couldn't clarify what I am trying to ask.
How do I load a single image with multiple images on it?
0
0
1
0
0
189
19,373,289
2013-10-15T04:26:00.000
0
0
0
0
0
python,mysql,apache-storm
1
20,010,872
0
1
0
false
1
0
Is it not possible for you to remove the 'IsNull' constraint from your MySQL database? I'm not aware of any where it is not possible to do this. Otherwise you could set a default string which represents a null value.
1
1
0
0
I'm just curious if there's a way to make the no default value warning I get from Storm to go away. I have an insert trigger in MySQL that handles these fields and everything is functioning as expected so I just want to remove this unnecessary information. I tried setting the default value to None but that causes an error because the fields do not allow nulls. So how do I make the warning go away?
How can I avoid "Warning: Field 'xxx' doesn't have a default value" in Storm?
0
0
1
1
0
770
19,394,658
2013-10-16T03:19:00.000
0
0
1
0
0
python,ibm-mq,pymqi
0
19,412,440
0
2
0
false
0
0
You can only get messages by MsgID, CorrelID or GroupID.
1
0
0
0
Using the module pymqi how do you get a message in MQ queue using a parameter, for example "UserIdentifier"? So, I would only get messages from the queue that possess this parameter "UserIdentifier". Thank you for your attention.
Python - PyMQI - Get a message from a queue MQ using parameter
0
0
1
0
0
1,295
19,411,111
2013-10-16T18:34:00.000
2
0
0
0
0
python,gtk,custom-controls,scrollbar,pygtk
0
19,477,901
0
1
0
true
0
1
Most widgets in Gtk do not have scrollbars. If you want to scroll the entire widget, you have to implement the GtkScrollable interface. Then, you add the widget to a GtkScrolledWindow. The scrolled window has the scrollbars, those GtkScrollbars are linked with GtkAdjustments which are passed to your custom widget through the GtkScrollable interface set_vadjustment and set_hadjustment. If you just want to add a scrollbar and control its behaviour yourself, then you need to somehow add a GtkScrollbar in your widget, which means you will need to make it a container too. The GtkScrollable approach is the following, first you implement vadjustment and hadjustment setters and getters, then when the GtkAdjustments are set, you set its lower and upper limits and the page size(how much of the widget is visible at once). After that, you connect their value-changed signal so you can refresh your widget when the scrollbars are dragged. A GtkScrollable doesn't get to check the scrollbars, only the adjustments that will be bound to the scrollbars. When drawing the widget you get the adjustments' value property in order to determine how much the scrollbars have shifted in the horizontal and vertical axes.
1
0
0
0
I'm working on a X-plotter like widget that plots incomming data live. I already searched for an solution to realize a scrolling along the x-axis if the widget has to much values and so they don't fit. I had the folling approaches to realize it: derive from a widget that supports scrolling and child widgets and add my own widget while making it bigger and bigger during the live updates: -> Which parent do I need to use and how do I avoid to draw all the stuff that is currently not visible? modify my widget in a way that it supports the scrollbars itself -> but how? draw/handle my own scrollbars -> worstcase :( I really searched the web for suggestions or examples, but there is nothing about how to "construct" custom controls in a good way (beyond drawing something) esp. in the case of interaction... Sorry but I'm a newbie at GTK in general :/
Python: Creating own Widget with scrollbars
0
1.2
1
0
0
574
19,422,749
2013-10-17T09:22:00.000
0
0
0
0
0
python,matplotlib
0
19,423,078
0
2
0
false
0
0
my 2 cents: x^3+y^3+y^2+2xy^2=0 y^2=-x^3-y^3-2xy^2 y^2>0 => -x^3-y^3-2xy^2>0 => x^3+y^3+2xy^2<0 => x(x^2+2y^2)+y^3<0 => x(x^2+2y^2)<-y^3 => (x^2+2y^2)<-y^3/x 0<(x^2+2y^2) => 0<-y^3/x => 0>y^3/x => (x>0 && y<0) || (x<0 && y>0) your graph will span across the 2nd and 4th quadrants
1
2
1
0
I would like to draw the curve a generic cubic function using matplotlib. I want to draw curves that are defined by functions such as: x^3 + y^3 + y^2 + 2xy^2 = 0. Is this possible to do?
how to draw a nonlinear function using matplotlib?
1
0
1
0
0
2,800
19,445,789
2013-10-18T09:10:00.000
0
0
1
0
0
python,regex,python-2.7
0
19,445,831
0
2
0
true
0
0
Wrap each sub-regexp in (). After the match, you can go through all the groups in the matcher (match.group(index)). The non-empty group will be the one that matched.
1
0
0
0
I have a multiple regex which combines thousands of different regexes e.g r"reg1|reg2|...". I'd like to know which one of the regexes gave a match in re.search(r"reg1|reg2|...", text), and I cannot figure how to do it since `re.search(r"reg1|reg2|...", text).re.pattern gives the whole regex. For example, if my regex is r"foo[0-9]|bar", my pattern "foo1", I'd like to get as an answer "foo[0-9]. Is there any way to do this ?
Find which part of a multiple regex gave a match
0
1.2
1
0
0
89
19,448,553
2013-10-18T11:26:00.000
0
0
1
1
0
python,windows-7,intellij-idea,virtualenv,python-2.6
0
19,448,864
0
2
0
false
0
0
Just install an appropriate python and virtualenv for that python directly on the windows 7 machine.
2
1
0
0
I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system.
IntelliJ IDEA - unix python virtualenv on WIndows
1
0
1
0
0
426
19,448,553
2013-10-18T11:26:00.000
0
0
1
1
0
python,windows-7,intellij-idea,virtualenv,python-2.6
0
19,809,928
0
2
0
false
0
0
I solved it. If connect with my virtual machine by remote debug tool. I add one line with IntellJ/PyCharm generate to entry point of paster script. Before debug i run script (using IntelliJ remote tool) with run application on virtual machine.
2
1
0
0
I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system.
IntelliJ IDEA - unix python virtualenv on WIndows
1
0
1
0
0
426
19,458,338
2013-10-18T20:17:00.000
0
0
0
0
0
python,google-bigquery
0
19,459,294
0
2
0
true
0
0
Unfortunately, there isn't a way to do this right now, since, as you realized, all results are flattened.
1
1
0
0
I have a few large hourly upload tables with RECORD fieldtypes. I want to pull select records out of those tables and put them in daily per-customer tables. The trouble I'm running into is that using QUERY to do this seems to flatten the data out. Is there some way to preserve the nested RECORDs, or do I need to rethink my approach? If it helps, I'm using the Python API.
Bigquery: how to preserve nested data in derived tables?
0
1.2
1
1
0
234
19,477,250
2013-10-20T12:21:00.000
1
0
1
0
0
python,image,file
0
19,477,441
0
2
0
false
0
0
I'm not going to tell you your code is horrendous. But you could simplify it. Everything in the try routine could be replaced by a single line: print 'Space for about', int(totstor*1048576/25), 'standard jpg image files available' In other words you can print the result of the calculation directly. Let int() take care of rounding, getting rid of ".0", etc., and rely on the fact that you can print integers (and most other data types) directly without converting them to a string. You simply chain together the items you need in the output using commas. (There are other ways of getting numbers into the desired output text, but this is simplest).
1
0
0
0
Someone on here asked a question similar to this, but it got quickly downvoted and closed due to the newbiness of it's nature. So I decided to answer it myself, and for others who want to know how to make this nifty program, because it isn't really such a bad idea. So here goes nothing!
Python Program to tell amount of image files that will fit on a disk/flash drive
0
0.099668
1
0
0
94
19,484,981
2013-10-21T01:35:00.000
2
1
1
0
0
python,python-2.7,licensing,gpl
0
19,485,013
0
2
0
true
0
0
You have no requirement to say that you modified it at all - your only obligation is to offer the source code to anyone who uses your version. However the best solution for you, the original authors and future users is probably to have your changes put back into the main source tree, assuming that they would be useful to other users! At which point you the version history would mark your changes, you could also add your name in a comment if you wished.
1
1
0
0
So I created my own modified version of a program with the GPLv3, and it's open source and everything. My question is how am I supposed to state that I modified it? Do I just put in a comment saying # Modified by yentup ? I've tried researching about this topic but I haven't found any directions on how to do so.
Is there a formal way to state modifications of a program covered with GPL?
0
1.2
1
0
0
685
19,509,911
2013-10-22T05:47:00.000
1
1
0
1
0
python
0
22,898,338
0
7
0
false
0
0
It's Nautilus's fault. Open Nautilus (the file manager), go to Menu > Preferences. Select the "Behaviour" section. On the field titled "Executable text files", select the option "Execute executable text files when opened".
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0.028564
1
0
0
12,507
19,509,911
2013-10-22T05:47:00.000
2
1
0
1
0
python
0
19,510,082
0
7
0
false
0
0
Add #!/usr/bin/env python at the very beginning of file. Make chmod u+x filename.py Change your extension from .py to .sh, so your linux distro's UI will recognize it as shell script and try to execute.
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0.057081
1
0
0
12,507
19,509,911
2013-10-22T05:47:00.000
0
1
0
1
0
python
0
19,510,040
0
7
0
false
0
0
If you don't have any specific version requirement then using first line as #!/usr/bin/env python will be more efficient and give the execute permission chmod u+x test.py
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0
1
0
0
12,507
19,509,911
2013-10-22T05:47:00.000
5
1
0
1
0
python
0
19,509,956
0
7
0
false
0
0
Add #!/bin/python as the very first line of your file. Or, if you don't know where your python executable is, type which python in a terminal; then copy the result of that and put it after the #!. Change the permissions of the file so that its executable chmod u+x test.py i try but it still open back as gedit Right click on the file in your gnome file browser or desktop. Select Properties Go to Open with and choose Python. If you don't see python in the list, add the command. Just type python in the command to be added.
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0.141893
1
0
0
12,507
19,509,911
2013-10-22T05:47:00.000
0
1
0
1
0
python
0
55,925,012
0
7
0
false
0
0
I use raspibian os (Linux) Add #!/usr/bin/python as the first line of the file.py right click file >> open with >> chose customize >> custom command line >> type python3 execute file with double click is working
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0
1
0
0
12,507
19,509,911
2013-10-22T05:47:00.000
0
1
0
1
0
python
0
19,509,975
0
7
0
false
0
0
Add #!/usr/bin/python as the first line of the file and set the permission to executable chmod 755 yourfile.
6
2
0
0
I am trying to make my python script executable without going through the terminal typing like python test.py I want to make it able to run when i click on the file. How i going to do this in my fedora machine.
how to make python script executable when click on the file
0
0
1
0
0
12,507
19,513,621
2013-10-22T09:11:00.000
1
0
0
0
0
ipython-notebook
0
19,535,347
0
4
0
false
0
0
$ ipython nbconvert ... --to slides (no serve option necessary) create a standalone html file you should be able to mail, or whatever. The skip/- logic can be applied to pdf generation too, you just have to write your own extended template (which is not that hard, wild guess ~20 lines)
2
2
0
0
so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way. My usecase is: I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc. In an optimal world there would be a fire-and-forget 'give me a pdf' button somewhere. So I did already view the slides locally via ipython nbconvert ... --to slides -- post serve But how do I distribute that to others? Can I get a pdf from such a slideshow easily (I do not care about transition animations etc.) I hope this is developed further, great features so far!
Distribute a slideshow from IPython notebook
0
0.049958
1
0
0
2,339
19,513,621
2013-10-22T09:11:00.000
1
0
0
0
0
ipython-notebook
0
21,978,035
0
4
0
false
0
0
You can print it as a pdf file from Chrome. Add "?print-pdf" at the end of your URL.e.g: 127.0.0.1:8000/index.html?print-pdf Select print menu from Chrome. Select Save As pdf, then print it out.
2
2
0
0
so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way. My usecase is: I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc. In an optimal world there would be a fire-and-forget 'give me a pdf' button somewhere. So I did already view the slides locally via ipython nbconvert ... --to slides -- post serve But how do I distribute that to others? Can I get a pdf from such a slideshow easily (I do not care about transition animations etc.) I hope this is developed further, great features so far!
Distribute a slideshow from IPython notebook
0
0.049958
1
0
0
2,339
19,527,097
2013-10-22T19:54:00.000
2
0
1
0
0
python,django,web
0
19,527,376
0
2
0
true
1
0
Yes, since the arguments will need to be converted to strings before outputting and that can be a costly operation. However, using print causes another issue. Some WSGI containers, notably mod_wsgi among them, do not like anything sent to stdout by default and so will raise an exception whenever that happens. You can fix this by printing to stderr instead, but the performance issue will remain.
1
0
0
0
We are using the python/Django for web development. While development phase wile coding i tends to put print statement a lot places to check the control flow of the code. And same code with print statement is uploaded for server, I know logging is a place to be more suitable but i find myself more comfortable with print. I want to know how few lines of code will make site slow, if it makes it slow. Lets say i have 100 line of code and upon that i added 5 print statements. another way of looking into it is to i wrote a 105 line of code. Then in that sense i should not make difference (i suppose). Does this will make the website slow ?
Does print statement will make performance issue for a website
0
1.2
1
0
0
1,976
19,556,467
2013-10-24T03:38:00.000
0
0
0
0
0
python,basehttprequesthandler
0
19,556,787
0
2
0
false
0
0
I think you have two choices. 1) Listen to all interfaces, but override BaseHTTPRequestHandler.init to check the client address and drop the connection if it comes from an undesired interface 2) Create multiple sockets, one per address you want to listen on. SocketServer.serve_forever() is blocking, so you will either need to use one thread per address or switch to a more sophisticated framework like twisted.
2
0
0
0
My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet. I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other one?
how to bind multiple specified ip address on BaseHTTPRequestHandler of python
0
0
1
0
1
758
19,556,467
2013-10-24T03:38:00.000
0
0
0
0
0
python,basehttprequesthandler
0
19,556,500
0
2
0
false
0
0
Generally, routers have an option where you can allow servers to be visible or not visible. If on the router you set you server to not be visible, then your server will not be accessible through the internet.
2
0
0
0
My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet. I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other one?
how to bind multiple specified ip address on BaseHTTPRequestHandler of python
0
0
1
0
1
758
19,600,545
2013-10-25T22:46:00.000
0
0
1
0
0
python,python-2.7
0
47,374,011
0
3
0
false
0
0
it has role similar to path. this variable tells the python interpreter where to locate the module files imported into a program. it should include the python source library directory and the directories contain in python source code
1
0
0
0
On windows 7, I currently don't have a python path. Can I safely make one? If so, how do I do it? Upon making this variable, I can no longer load Spyder (IDE) without it crashing. Does anyone know why? I would like to edit my existing python path if possible, but just don't know why it isn't already there in environmental variables. I would ultimately like to be able to run "python myscript.py" and have myscript be in a different directory from the call directory.
What is the purpose of the environmental variable PYTHONPATH
1
0
1
0
0
1,331
19,606,275
2013-10-26T11:43:00.000
0
0
1
0
0
ipython,ipython-notebook
0
51,346,139
0
6
0
false
0
0
If you want completely from beginning, Just go and delete the following file manually(It worked for me) /home/user/.ipython/profile_default/history.sqlite
2
40
0
0
I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good. I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless enough to type password = or similar chosen terms. Thanks Comments I don't need: %clear only clears the session. It does not wipe the history. Yes. I will only use xSA_keys from now on.
IPython: How to wipe IPython's history selectively & securely?
0
0
1
0
0
17,232
19,606,275
2013-10-26T11:43:00.000
1
0
1
0
0
ipython,ipython-notebook
0
52,141,421
0
6
0
false
0
0
I couldn't find the way to wipe IPython's history selectively, but I found out how to wipe data by built-in func, non-sqlite way: %clear out #it clears output history by the way, you can also clear in history by %clear in
2
40
0
0
I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good. I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless enough to type password = or similar chosen terms. Thanks Comments I don't need: %clear only clears the session. It does not wipe the history. Yes. I will only use xSA_keys from now on.
IPython: How to wipe IPython's history selectively & securely?
0
0.033321
1
0
0
17,232
19,612,221
2013-10-26T21:42:00.000
0
1
0
1
1
eclipse,python-3.x,command-line-arguments,pydev,windows-8.1
0
19,624,100
0
1
0
false
0
0
I answered my own question in the comment above. I just had to wait to post an answer due to the fact that I just created a stackoverflow account yesterday.
1
0
0
0
This goes out to anyone who is well versed in the Eclipse IDE and or PyDev perspective plug-in who is willing to offer some technical support. I am trying to write a python module that must take in arguments from the command prompt with sys.argv function calls. Rather than printing out the correct output when I enter E:\ ... \src>program.py arg1 arg2, all that happens is a new command line (E:\ ... \src>) is output and the Eclipse IDE window flashes orange without any code in my python module actually being executed. Also, if I close the Eclipse IDE and try to run program.py, it will just open Eclipse again and open my program in a new tab. I'm confused as to why it is not working now when just last week it was working perfectly while testing another program that took in arguments from the command prompt by sys.argv function calls. My question for everyone is whether or not you are aware of any settings that may have been altered by updates, etc. that could cause this problem; or has anybody out there ever run into this problem and figured out how to resolve it? I have already checked my PATH variable, so that is not the problem :-(. Any help you can provide would be greatly appreciated ... thank you. OS: Windows 8.1 Pro / Eclipse ver.: Kepler (4.3) / Python ver.: 3.3.2
Python module will not run correctly from command prompt
0
0
1
0
0
213
19,612,642
2013-10-26T22:37:00.000
1
0
0
1
0
java,android,python,google-app-engine
0
19,613,781
0
1
0
true
1
0
Yes, you can use Python to do what you want. Google designs their services (such as GAE and endpoints) to be language agnostic, e.g. using JSON to serialize objects. There are a few advantages to using Java on both, such as being able to share code between client and service projects, but Google does not promote such dependencies at all - you will have no problem using Python instead.
1
0
0
0
Am I confused as to what is possible between an Android Client and Google App Engine? I would like to be able to create a Python API that would handle requests between GAE services such as Datastore, and an Android Client. I have found some examples that detail how to make a call from within an Android Client, but it doesn't seem to outline whether or not you can pass data to any specific API language. The question I have is whether or not it is possible to use a Python API deployed on GAE and making calls through Google End Points, or would I have to use Java Servlets to handle requests?
Android Client and Google App Engine APIs
1
1.2
1
0
0
127
19,622,526
2013-10-27T19:34:00.000
0
0
1
0
0
python,python-3.x,binary,numbers,decimal
0
19,622,796
0
5
0
false
0
0
The general formula for base B is as follows: (B^N + ... + B^1 + B^0)*(B-1) = (B^(N+1) + ... + B^2 + B^1) - (B^N + ... + B^1 + B^0) = B^(N+1) - B^0 = B^(N+1)-1 Examples: B=2 and N=3 gives 2^4 - 1 = 1111 binary B=10 and N=3 gives 10^3 - 1 = 999 decimal
4
2
0
0
can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ? I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something..
Binary to decimal conversion - formula explanation
1
0
1
0
0
426
19,622,526
2013-10-27T19:34:00.000
1
0
1
0
0
python,python-3.x,binary,numbers,decimal
0
19,622,562
0
5
0
false
0
0
Think of it like this, 111 is 1 less than 1000 (8 in binary).
4
2
0
0
can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ? I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something..
Binary to decimal conversion - formula explanation
1
0.039979
1
0
0
426
19,622,526
2013-10-27T19:34:00.000
2
0
1
0
0
python,python-3.x,binary,numbers,decimal
0
19,622,553
0
5
0
true
0
0
It is a unique property of number 2 that the sum of it's previous powers is equal to the next power level subtracted by 1. In other words: 2^n=2^0+2^1+2^2+...+2^(n-1)+1 for n in (1,2,3...) If you need proof, use mathematical induction. Base: n=1; 2^1=2=2^0+1=1+1 Suppose that for n=k the property 2^n=2^0+2^1+...+2^(n-1)+1 is satisfied For n=k+1 you have 2^n=(2^k)*(2^1) then apply the hypothesis and you have 2^n=(2^0+2^1+...+2^(n-2)+1)*2 which yields 2^n=(2^1+2^2+...+2^(n-1)+2)=1+2^0+2^1+...+2^(n-1) which concludes our proof.
4
2
0
0
can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ? I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something..
Binary to decimal conversion - formula explanation
1
1.2
1
0
0
426
19,622,526
2013-10-27T19:34:00.000
1
0
1
0
0
python,python-3.x,binary,numbers,decimal
0
19,622,560
0
5
0
false
0
0
Add 1 to 111: the result is 1000. It follows, therefore, that: 111 + 1 = 1000 → 1000 - 1 = 111 Now, 1000 is 23, hence: 23 - 1 = 111 Of course, you can say something similar about binary numbers with any number of 1s
4
2
0
0
can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ? I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something..
Binary to decimal conversion - formula explanation
1
0.039979
1
0
0
426
19,624,968
2013-10-27T23:30:00.000
0
0
0
0
0
python
1
54,815,571
0
1
0
false
0
1
I had the same issue caused by a top level window I had created and withdrawn but didn't destroy. Properly destroying it fixed my issue.
1
1
0
0
I made a program, which uses tkinter to create a window where stuff happens. It contains images and loops to constantly shift and move the images. Now, when I close the window, the scripts are still running and it creates error messages that it has nowhere to place the images with new coordinates. I think that the loops are still running. So my question is, how do I close the program all together after clicking the x on the window. Is there a way to bind the x(close window) to terminate the program, or cat n ibe done inside a code, to see when the tkinter window is closed(to me this way seems to be bad, because it would keep checking for if the window is still existing or not). Thanks a lot!
Closing a python program window leaves program still running in the background
0
0
1
0
0
1,700
19,663,625
2013-10-29T16:12:00.000
6
0
1
0
0
python,python-3.x,word-wrap
0
19,664,045
0
1
0
false
0
0
Text wrapping is a function of your terminal, not python. All that python does is send a string to the terminal - think about it, when you say print "abcdef\n", there's no character in there that tells the terminal to wrap-text! You just need to configure the environment you're coding in. There should be a pretty easily accessible 'settings' option. However, if you can't find it, then tell us what environment you're using - we might be able to help.
1
1
0
0
I’m trying to print a string that is too long to be displayed on one line, so it automatically wraps to the next line. The problem is that I need it to all stay on one line and just go off the screen (where I can just scroll left to right to see it all).Is there a way to to disable word wrap in python IDLE by changing somethings in configure option
how to disable WORD WRAP in python IDLE
0
1
1
0
0
6,081
19,674,364
2013-10-30T05:16:00.000
0
0
1
0
0
python,call,mousemove,xdotool
0
19,674,382
0
2
0
false
0
0
Remove the quotes. If you keep quotes, it will treat as a string. call(["xdotool", "mousemove", "500","600"])
1
0
0
0
I am using Python on Ubuntu. call(["xdotool", "mousemove", "500","600"])works fine. But if x=500, y=600, call(["xdotool", "mousemove", "x","y"]) does not work. What should be the syntax of x and y?
In Python how to use variables in call function?
0
0
1
0
0
159
19,692,437
2013-10-30T19:44:00.000
0
0
1
1
0
python,networking,synchronization,wmi,apscheduler
0
19,737,941
0
1
0
false
0
0
I tried to include functionality like this in APScheduler 2.0 but it didn't pan out. Maybe The biggest issue is handling concurrent accesses to jobs and making sure jobs get run even if a particular node crashes. The nodes also need to communicate somehow. Are you sure you don't want to use Celery instead?
1
1
0
0
I am using apscheduler and wmi to create and install new python based windows services where the service determines the type of job to be run. The services are installed across all the machines on the same network. Given this scenario I want to make sure that these services run only on one machine and not all the machines. If a machine goes down I still want the job to be run from another machine on the same network. How would I accomplish this task? I know I need to do some kind of synchronization across machines but not sure how to address it?
syncronizing across machines for a python apscheduler and wmi based windows service
0
0
1
0
0
170
19,696,973
2013-10-31T01:40:00.000
1
1
0
1
0
python,ubuntu,python-2.7,python-3.x,pyside
1
19,697,689
0
1
0
true
0
0
You have two independent Python 2.7 installations, one in /usr and one in /usr/local. (And that's on top of the Python 3.x installation you also have.) This is bound to cause confusion, especially for novices. And it has caused exactly the kind of consuion it was bound to cause. You've installed PySide into the /usr installation, so it ended up in /usr/lib/python2.7/dist-packages. If you run /usr/bin/python, that import PySide will probably work fine. (If not, see below.) But the default thing called python and python2.7 on your PATH is the /usr/local installation, hence which python says /usr/local/bin/python, so it can't see PySide at all. So you need to get it installed for the other Python as well. Unless you know that you need a second Python 2.7 in /usr/local for some reason, the simplest thing to do would be to scrap it. Don't uninstall it and reinstall it; just uninstall it. You've already got a Python 2.7 in /usr, and you don't need two of them. If you really need to get PySide working with the second 2.7… Since you still haven't explained how you've been installing PySide despite being asked repeatedly, I can't tell you exactly how to do that. But generally, the key is to make sure to use explicit paths for all Python programs (python itself, python-config, pip, easy_install, etc.) that you have to run. For example, if the docs or blog or voices in your head tell you to run easy_install at some step, run /usr/local/bin/easy_install instead. If there is no such program, then you need to install that. The fact that you already have /usr/bin/easy_install doesn't help—in fact, it hurts. If you can get rid of the second Python, but that doesn't fix PySide yet, uninstall, rebuild, and reinstall PySide. Or, even simpler… PySide has pre-made, working binary Ubuntu packages for all of the major Python versions that have Ubuntu packages. Just install it that way.
1
1
0
0
I had PyQt4 running fine with python2 on Ubuntu 12.04. I then installed python-PySide. But the installation test would give me a module not found error. Then I installed python3-PySide and it works fine. So obviously something to do with my environment paths, but I'm not sure what I need to do. I'm guessing PySide is automatically checking if python3 exists and if it does then it'll use it regardless. I need PySide to work with python2.7 because of Qt4.8 compatibility issues. Any suggestions? some info about my system: which python /usr/bin/local/python which python3 /usr/bin/python3 EDIT: More details about installation test. After installation, I bring up the python console and try import PySide, as follows: python import PySide ImportError: No module name PySide But it works fine for python3: python3 import PySide PySide.version '1.1.2'
Ubuntu - PySide module not found for python2 but works fine for python3
0
1.2
1
0
0
1,553
19,697,730
2013-10-31T03:00:00.000
0
0
1
0
0
python,pip
0
19,698,648
0
3
0
false
0
0
I don't think pip can do this. If you are in virtualenv you just delete it and reinstall into new one. If you are in system, you should never use pip but the distribution package manager.
1
2
0
0
For example, I may have installed pkg1, which requires pkg2 and pkg3. No other packages I have installed require these two. So, during or after pip uninstall pkg1, how can I make pip uninstall pkg2 and pkg3?
How can I make pip uninstall packages that are no longer required by other packages?
0
0
1
0
0
290
19,702,170
2013-10-31T08:59:00.000
2
0
0
1
0
python,django,raspberry-pi
1
19,702,189
0
1
1
true
1
0
You don't have to run the webbrowser as root but your django app (the webserver). Of course running a web application as root is an incredibly bad idea (even on a pi), so you might want to use a separate worker process (e.g. using celery) that runs as root and accesses the GPIOs.
1
0
0
0
I am using Django 1.5.4 to design a web page in which i want to use GPIO, but i got following error: "Noᅠaccessᅠtoᅠ/dev/mem. Tryᅠrunningᅠasᅠroot! " in browser. Since web browser itself is an application, how can i assign "root" privileges to it when it tried to render a web page ? If it can be done without any need to install anything that would be better as other frameworks/applications who are able to use GPIO in web page must have made some tweaks.I tried searching for similar questions for this area but couldn't find this specific case ( django + gpio access). Any help would be greatly appreciated. Thanks
Using GPIO in webpage
0
1.2
1
0
0
467
19,713,141
2013-10-31T17:35:00.000
0
0
0
1
0
python,amazon-web-services,amazon-s3,amazon-ec2,cluster-computing
0
19,714,085
0
1
1
false
1
0
You do not need to use S3, you would likely want to use EBS for storing the code if you need it to be preserved between instance launches. When you launch an instance you have the option to add an ebs storage volume to the drive. That drive will automatically be mounted to the instance and you can access it just like you would on any physical machine. ssh your code up to the amazon machine and fire away.
1
0
0
0
I have never used amazon web services so I apologize for the naive question. I am looking to run my code on a cluster as the quad-core architecture on my local machine doesn't seem to be doing the job. The documentation seems overwhelming and I don't even know which AWS services are going to be used for running my script on EC2. Would I have to use their storage facility (S3) because I guess if I have to run my script, I'm going to have to store it on the cloud in a place where the cluster instance has access to the files or do I upload my files somewhere else while working with EC2? If this is true is it possible for me to upload my entire directory which has all the contents of the files required by my application onto s3. Any guidance would be much appreciated. So I guess my question is do I have to use S3 to store my code in a place accessible by the cluster? If so is there an easy way to do it? Meaning I have only seen examples of creating buckets wherein one file can be transferred per bucket. Can you transfer an entire folder into a bucket? If we don't require to use S3 then which other service should I use to give the cluster access to my scripts to be executed? Thanks in advance!
how to run python code on amazon ec2 webservice?
1
0
1
0
0
718
19,717,288
2013-10-31T21:56:00.000
0
1
1
0
0
python,backup,archive,cd,dvd
0
19,717,555
0
2
1
false
0
0
Writing your own backup system is not fun. Have you considered looking at ready-to-use backup solutions? There are plenty, many free ones... If you are still bound to write your own... Answering your specific questions: With CD/DVD you first typically have to master the image (using a tool like mkisofs), then write image to the medium. There are tools that wrap both operations for you (genisofs I believe) but this is typically the process. To verify the backup quality, you'll have to read back all written files (by mounting a newly written CD) and compare their checksums against those of the original files. In order to do incremental backups, you'll have to keep archives of checksums for each file you save (with backup date etc).
2
3
0
0
I have to archive a large amount of data off of CDs and DVDs, and I thought it was an interesting problem that people might have useful input on. Here's the setup: The script will be running on multiple boxes on multiple platforms, so I thought python would be the best language to use. If the logic creates a bottleneck, any other language works. We need to archive ~1000 CDs and ~500 DVDs, so speed is a critical issue The data is very valuable, so verification would be useful The discs are pretty old, so a lot of them will be hard or impossible to read Right now, I was planning on using shutil.copytree to dump the files into a directory, and compare file trees and sizes. Maybe throw in a quick hash, although that will probably slow things down too much. So my specific questions are: What is the fastest way to copy files off a slow medium like CD/DVDs? (or does the method even matter) Any suggestions of how to deal with potentially failing discs? How do you detect discs that have issues?
What is the best way to archive a data CD/DVD in python?
0
0
1
0
0
1,815
19,717,288
2013-10-31T21:56:00.000
1
1
1
0
0
python,backup,archive,cd,dvd
0
19,775,252
0
2
1
true
0
0
When you read file by file, you're seeking randomly around the disc, which is a lot slower than a bulk transfer of contiguous data. And, since the fastest CD drives are several dozen times slower than the slowest hard drives (and that's not even counting the speed hit for doing multiple reads on each bad sector for error correction), you want to get the data off the CD as soon as possible. Also, of course, having an archive as a .iso file or similar means that, if you improve your software later, you can re-scan the filesystem without needing to dig out the CD again (which may have further degraded in storage). Meanwhile, trying to recovering damaged CDs, and damaged filesystems, is a lot more complicated than you'd expect. So, here's what I'd do: Block-copy the discs directly to .iso files (whether in Python, or with dd), and log all the ones that fail. Hash the .iso files, not the filesystems. If you really need to hash the filesystems, keep in mind that the common optimization of compression the data before hashing (that is, tar czf - | shasum instead of just tar cf - | shasum) usually slows things down, even for easily-compressable data—but you might as well test it both ways on a couple discs. If you need your verification to be legally useful you may have to use a timestamped signature provided by an online service, instead, in which case compressing probably will be worthwhile. For each successful .iso file, mount it and use basic file copy operations (whether in Python, or with standard Unix tools), and again log all the ones that fail. Get a free or commercial CD recovery tool like IsoBuster (not an endorsement, just the first one that came up in a search, although I have used it successfully before) and use it to manually recover all of the damaged discs. You can do a lot of this work in parallel—when each block copy finishes, kick off the filesystem dump in the background while you're block-copying the next drive. Finally, if you've got 1500 discs to recover, you might want to invest in a DVD jukebox or auto-loader. I'm guessing new ones are still pretty expensive, but there must be people out there selling older ones for a lot cheaper. (From a quick search online, the first thing that came up was $2500 new and $240 used…)
2
3
0
0
I have to archive a large amount of data off of CDs and DVDs, and I thought it was an interesting problem that people might have useful input on. Here's the setup: The script will be running on multiple boxes on multiple platforms, so I thought python would be the best language to use. If the logic creates a bottleneck, any other language works. We need to archive ~1000 CDs and ~500 DVDs, so speed is a critical issue The data is very valuable, so verification would be useful The discs are pretty old, so a lot of them will be hard or impossible to read Right now, I was planning on using shutil.copytree to dump the files into a directory, and compare file trees and sizes. Maybe throw in a quick hash, although that will probably slow things down too much. So my specific questions are: What is the fastest way to copy files off a slow medium like CD/DVDs? (or does the method even matter) Any suggestions of how to deal with potentially failing discs? How do you detect discs that have issues?
What is the best way to archive a data CD/DVD in python?
0
1.2
1
0
0
1,815
19,719,746
2013-11-01T02:07:00.000
3
0
0
0
0
python,numpy
0
19,719,936
0
3
0
true
0
0
Because of the strided data structure that defines a numpy array, what you want will not be possible without using a masked array. Your best option might be to use a masked array (or perhaps your own boolean array) to mask the deleted the rows, and then do a single real delete operation of all the rows to be deleted before passing it downstream.
1
8
1
0
Given a large 2d numpy array, I would like to remove a range of rows, say rows 10000:10010 efficiently. I have to do this multiple times with different ranges, so I would like to also make it parallelizable. Using something like numpy.delete() is not efficient, since it needs to copy the array, taking too much time and memory. Ideally I would want to do something like create a view, but I am not sure how I could do this in this case. A masked array is also not an option since the downstream operations are not supported on masked arrays. Any ideas?
How can one efficiently remove a range of rows from a large numpy array?
0
1.2
1
0
0
2,948
19,745,169
2013-11-02T18:16:00.000
0
0
0
1
0
python,google-app-engine,google-docs-api
0
19,746,281
0
1
0
true
1
0
There is currently no API to create google docs directly except for: 1) make a google apps script service, which does have access to the docs api. 2) create a ".doc" then upload and convert to gdoc. 1 is best but a gas service has some limitations like quotas. If you are only creating dozens/hundreds per day you will be ok with quotas. Ive done it this way for something similar as your case.
1
0
0
1
Listmates: I am designing a google app engine (python) app to automate law office documents. I plan on using GAE, google docs, and google drive to create and store the finished documents. My plan is to have case information (client name, case number, etc.) entered and retrieved using GAE web forms and the google datastore. Then I will allow the user to create a motion or other document by inserting the form data into template. The completed document can be further customized by the user, email, printed, and/or stored in a google drive folder. I found information on how to create a web page that can be printed. However, I am looking for information for how to create an actual google doc and insert the form data into that document or template. Can someone point me to a GAE tutorial of any type that steps me through how to do this?
How can I automate google docs with Google App Engine?
0
1.2
1
0
0
559
19,746,350
2013-11-02T20:11:00.000
1
0
1
0
0
jupyter-notebook,ipython,markdown
0
71,530,683
0
10
0
false
0
0
This is a very simple and effective trick for google colab. Use the (empty) link syntax of the markdown. [your_message]() Then you'll get the blue text (underline).
1
155
0
0
I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word. I don't want to change the look of the whole notebook (via a CSS file).
How to change color in markdown cells ipython/jupyter notebook?
0
0.019997
1
0
0
244,278
19,747,751
2013-11-02T22:45:00.000
1
0
1
0
0
python,list
0
19,747,785
0
4
0
false
0
0
I'd write it as a generator. Repeat: read as many A's as possible, read as many B's as possible, if you've read exactly 1 A and 1 B, yield them; otherwise ignore and proceed. Also this needs an additional special case in case you want to allow the input to end with an A.
1
4
0
0
Given a list of strings, where each string is in the format "A - something" or "B - somethingelse", and list items mostly alternate between pieces of "A" data and "B" data, how can irregularities be removed? Irregularities being any sequence that breaks the A B pattern. If there are multiple A's, the next B should also be removed. If there are multiple B's, the preceding A should also be removed. After removal of these invalid sequnces, list order should be kept. Example: A B A B A A B A B A B A B A B B A B A B A A B B A B A B In this case, AAB (see rule 2), ABB (see rule 3) and AABB should be removed.
How to maintain a strict alternating pattern of item "types" in a list?
0
0.049958
1
0
0
188
19,756,725
2013-11-03T18:57:00.000
0
0
0
0
0
python,django,paypal,django-paypal
0
21,199,468
0
1
1
false
1
0
With respect, the question is slightly naive, in that there is typically a separation between the shopping cart, and the payment processing. A payment returns a binary result - it either worked or it didn't. It is up to your application to recall what was being paid for. The Paypal API returns the success or failure of an identified payment; plus will happily consume a list of items you give it, so that the user is presented with a breakdown of the total amount. But note that you are telling paypal what is being paid for. It is consuming that data, not providing it. So the answer depends entirely upon your chosen solution (django-paypal or django-merchant or whatever). Read their documentation. Presumably there is some way to inspect the contents of a recently approved transaction. Cycle through the cart and enable a download of each. Django-paypal, for example, has no interest of what is in the cart. It just fires a signal when a payment is successful, and passes back the transaction identifier. Your application must recall what the transaction was for. Often it's not as easy as you'd hope.
1
2
0
1
I have an existing django website, and I would like to sell some pdf files through it using paypal. The buyer needs to be able to select 1 or more books, get transferred to the paypal site to enter in payment info. Then after a successful payment, the buyer gets redirected back to my website and the books start downloading automatically. I have looked at the django-paypal and django-merchent apps, but I don't know how to handle the multiple downloads. As far as I know, using these apps, after a successful purchase, the app sends a success signal, but doesn't tell me which books were ordered. What is the best way to implement this either with the django-paypal app or using some other method? Again, I'm looking for the easiest/quickest solution. Thanks,
Easiest way to implement paypal shopping for e-books
0
0
1
0
0
165
19,759,096
2013-11-03T22:42:00.000
1
0
0
0
0
python,wxpython,wxwidgets
0
19,760,286
0
2
0
true
0
1
Validate() is called only when the dialog is about to close by default, but you may also call it yourself when the control loses focus. Finally, if your control doesn't accept some characters at all, you can also intercept wxEVT_CHAR events to prevent them from being entered. I do believe wxPython demo shows how to do it.
1
0
0
0
I'm trying to create Validators for inputs on forms. I learned already that in wxPython it is necessary to inherit from wx.Validator due to lack of support for standard wxTextValidator and others. My question is: how effectively check that string complies to simple rules (no regexp please) acceptableChars = ['a', 'b', ...] all(char in acceptableChars for char in string) is something like this efficient? and how to cleanly specify all alphanumeric or digits? or maybe is there any ready class or function? will overriding Validate method only keep the constraints while inputing data - I mean will it prevent user from entering digits into alphanumerical TextCtrl or will it check only at closing the modal diagog?
Validating data in wxPython
1
1.2
1
0
0
215
19,761,351
2013-11-04T03:47:00.000
1
1
1
0
0
python,matlab,python-2.7,path,directory
1
19,761,894
0
2
0
false
0
0
Your $PATH should control where python comes from, but I don't believe it will control where your pgcode.py comes from - at least, not in the way you're using it now. You might want to either use a #!/usr/bin/env python and make your script executable, or be very mindful of what directory you're in when you try to python pgcode.py (you can prepend "pwd;" to your python command to see), or specify a full path to pgcode.py. HTH
1
0
0
0
I am looking to run a file I created in python from a matlab script. I have checked that my python file works if I run it from the python interface. However I have not been able to get my python to run from matlab. The following is the code situation I am in. In matlab., I have the following code:(My file name is pgcode.py) ! python pgcode.py and interchangeably I have use this code as well: system('python pgcode.py') The error that results in matlab is: "python: can't open file 'pgcode.py': [Errno 2] No such file or directory" I have set my PATH directory and I really think this is an issue with setting the path so that I can find the file I have created but I haven't been able to figure out how to do this. I am using windows and Python 2.7.5. Any help is much appreciated. Thanks in advance!
Run Python file from matlab .m file
0
0.099668
1
0
0
746
19,761,898
2013-11-04T05:01:00.000
0
0
0
0
1
python,django,windows
0
19,762,217
0
2
0
false
1
0
It is hard to tell whether the issue is related to Windows specifically, rather than compatibility issues with images/CSS/Javascript/plugins such as Flash. Are you running the latest versions of those browsers (or at least the same versions as on your desktop)? Do you have different security software/firewalls? Do other sites load inconsistently? Seems unlikely to be a Django issue (although you can try loading sites like djangoproject.com).
1
0
0
0
I have several django projects and they work well on my desktop. But when I run them on my laptop, they run ok for sometime. Then on a random occasion, opening a page won't work. The browser keeps trying to load the page (title tab keeps spinning, URL changes to the page its trying to open, and the page turns blank), while the development server (django on windows shell) says it has successfully served the page (200 status). This behavior is consistent among Firefox, IE and Chrome. I tried changing ports, using machine IP instead of localhost, loading static files on external server, but nothing works. I tried opening the site (using laptop computer name) from desktop browsers and behaves the same. Another interesting thing is, even if I shutdown and restart the django server, I wont be able to open the page that have failed previously unless I close the loading page. My laptop is running a basic Windows 8, while desktop is Windows 8 Pro. I think the windows version has something to do with it. Does anyone know how to solve this? I hope I made myself clear. Thanks.
Why does django stops loading a page after opening several pages?
0
0
1
0
0
908
19,776,571
2013-11-04T20:31:00.000
30
0
0
1
0
macos,error-handling,ipython,dlopen
1
22,560,206
0
1
0
true
0
0
Shared object location under OS X is sometimes tricky. When you directly call dlopen() you have the freedom of specifying an absolute path to the library, which works fine. However, if you load a library which in turn needs to load another (as appears to be your situation), you've lost control of specifying where the library lives with its direct path. There are environment variables that you could set before running your main program that tell the dynamic loader where to search for things. In general these are a bad idea (but you can read about them via the man dyld command on an OS X system). When an OS X dynamic library is created, it's given an install name; this name is embedded within the binary and can be viewed with the otool command. otool -L mach-o_binary will list the dynamic library references for the mach-o binary you provide the file name to; this can be a primary executable or a dylib, for example. When a dynamic library is statically linked into another executable (either a primary executable or another dylib), the expected location of where that dylib being linked will be found is based on the location written into it (either at the time it was built, or changes that have been applied afterwards). In your case, it seems that phys_services.so was statically linked against libphys-services.dylib. So to start, run otool -L phys_services.so to find the exact expectation of where the dylib will be. The install_name_tool command can be used to change the expected location of a library. It can be run against the dylib before it gets statically linked against (in which case you have nothing left to do), or it can be run against the executable that loads it in order to rewrite those expectations. The command pattern for this is install_name_tool -change <old_path> <new_path> So for example, if otool -L phys_services.so shows you /usr/lib/libphys-services.dylib and you want to move the expectation as you posed in your question, you would do that with install_name_tool -change /usr/lib/libphys-services.dylib @rpath/lib/libphys-services.dylib phys_services.so. The dyld man page (man dyld) will tell you how @rpath is used, as well as other macros @loader_path and @executable_path.
1
12
0
0
I am a newbie in this field. My laptop is Macbook air, Software: OS X 10.8.5 (12F45). I am running a code which gives me the following error: dlopen(/Users/ramesh/offline/build_icerec/lib/icecube/phys_services.so, 2): Library not loaded: /Users/ramesh/offline/build_icerec/lib/libphys-services.dylib Referenced from: /Users/ramesh/offline/build_icerec/lib/icecube/phys_services.so Reason: image not found I did google search and found variety of answers. I think the one that works is to use " -install_name @rpath/lib ". My question is, how to use -install_name @rpath/lib in my case?
Error: dlopen() Library not loaded Reason: image not found
0
1.2
1
0
0
27,135
19,779,371
2013-11-04T23:36:00.000
1
0
0
1
1
python,command-line,compiler-construction,command-line-interface,python-2.6
1
19,783,232
0
1
0
true
0
0
Closing the loop: bdist in the path is a sign that the package was installed with setup.py install and is running from the standard Python system path, not from wherever you have it checked out. Easy fix is to setup.py install it again. Harder fix is to uninstall it and fiddle with Apache's working directory, but that's not quite my area. :)
1
0
0
0
I have a script that I am running at /var/scripts/SomeAppName/source/importer/processor.py That script triggers an error that has a line that says: File "build/bdist.linux-i686/egg/something/cms/browser.py", line 43, in GetBrowser The problem I'm running into is that I'm unable to locate build/bdist.linux-i686/egg/something/cms/browser.py but I can locate /var/scripts/AnotherApp/appcommon/cms/browser.py and /var/scripts/AnotherApp/build/lib/appcommon/cms/browser.py I have modieified both of those files to remove the part that is throwing the error but am still getting the same error as if the file hasn't been modified at all. I'm guessing the problem is that I'm not modifying the correct file or I need to compile the script some how but I'm just not able to find out where/how to do this. I have tried restarting apache but with no luck. Any help or guidance as to where I should be looking or if I need to run some sort of command to re-compile to browser.py file would be appreciated.
I can't locate correct Python script to update
0
1.2
1
0
0
40
19,787,324
2013-11-05T10:55:00.000
0
0
0
0
0
python,macos,user-interface,pygame
0
19,800,717
0
1
0
false
0
1
Well, this ended up working. When I want to hide the window, I do pygame.display.quit() and make my code properly handle not having a display. When I want to show it, I do pygame.display.set_mode(...) with the former resolution. The net effect is that of hiding & showing the window. Unfortunately the window gets created in a different spot than where it started, and although apparently you can tell SDL to create the window in a particular spot, I haven't been able to find a way to get the window's location...
1
1
0
0
Pressing command-H in OSX immediately hides the active window. How do I achieve the same effect, programmatically, from Python? Specifically, I'd like to find a particular window that my application creates and then be able to show & hide it programmatically. I already know how to do this with pywin32 but I'm afraid my expertise there doesn't quite cover OSX as well. If it helps, the window in question is one created by pygame. I know that pygame has pygame.display.iconify() but that doesn't satisfy my requirements - the window doesn't disappear immediately, but rather the disappearance is animated, and there's no corresponding "uniconify" function that I can find.
hide pygame window on OSX
0
0
1
0
0
819
19,799,893
2013-11-05T21:59:00.000
0
0
0
0
0
python,pandas
0
19,800,482
0
1
0
false
0
0
I suppose you could create another column that is the Hour and subtract the time in question and get the absolute (unsigned) value that you could then do the min function on.. It is not code but I think the logic is right (or at least close.. after you find the mins,, then you can select them and then do your resample..
1
1
1
0
I'm using pandas to get hourly data from a dataset with fifteen minute sampling intervals. My problem using the resample('H', how='ohlc') method is that it provides values within that hour and I want the value closest to the hour. For instance, I would like to take a value sampled at 2:55 instead of one from 3:10, but can't figure out how to find the value that is closest if it occurs prior to the timestamp being evaluated against. Any help would be greatly appreciated.
Using Pandas to get the closest value to a timestamp
0
0
1
0
0
630
19,815,949
2013-11-06T15:23:00.000
0
0
0
0
1
python,django
0
65,434,713
0
4
0
false
1
0
if you just want to set an initial value in the form, form = MyForm(initial={'field': field_var})
1
4
0
0
I'm using a forms.ModelForm to set a model's attributes. For one of the attributes, I'd like to set a default value, and I want to handle it in the form, thus no default=value on the model attribute in the model class. On the form, though, I don't want to show the user the value, not even a hidden value, therefore, I can't put the field in fields=(...) and because of that, I can't use the field.initial=value way of setting the default. I could override validation or saving methods and squeeze a attribute setting in there, but this is not what I would prefer to do. Are there any "proper" or more elegant ways of solving this problem?
How to set form field default value without showing the field in django forms?
0
0
1
0
0
6,103
19,829,516
2013-11-07T06:39:00.000
2
0
1
1
0
python,windows,python-2.7,cmd
0
19,829,607
0
3
0
false
0
0
You can check registry by: HKLM SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath or HKCU
1
30
0
0
I am trying to get the installed path of python? Any idea how to get the python installed path from command line in windows. I don't want to set the environment variable? Thanks,
how to get python installed path from command line
0
0.132549
1
0
0
85,755
19,854,866
2013-11-08T08:47:00.000
0
0
0
1
0
python,desktop,os.system,mstsc
0
29,933,838
0
1
0
false
0
0
To close one of the mstsc, you should know the pid of it. If you are opening mstsc.exe from a python script itself, then you could capture the pid of that instance. p = Popen('C:\Windows\System32\mstsc.exe "connection.rdp"') print p.pid Then kill the exe using pid.
1
1
0
0
I want to automate closing the remote desktop application using python. I open the remote desktop using mstsc. When I do os.system("TASKKILL /F /IM mstsc.exe") It is killing all the remote desktop applications that are open. Is there a way I can specify through python which remote desktop it has to close. I have 2 or more instances of remote desktop open and I require my program to close only specific connection. Is there a way I can pass the IP address or process ID or something.
how to close remote desktop window using python
0
0
1
0
0
1,415
19,864,484
2013-11-08T16:55:00.000
3
0
0
0
0
python,pygame
0
19,864,546
0
1
0
false
0
1
You probably shouldn't be trying to launch a new instance of your game. You should create a reset method which can be called to restart everything. It would clear all variables, set the game state back to the start, etc.
1
0
0
0
I am trying to develop GUI for a who wants to be a millionaire game using pygame. If the user is presented with the welcome screen and clicks new game, it should clear the welcome screen and bring up the main game screen. I tried using os.system('xxx.py') but it doesnt stay on, it just flashes and goes off. Any ideas on how to make this work? Thanks in anticipation.
Clear previous screen to show next screen pygame
0
0.53705
1
0
0
208
19,883,186
2013-11-09T21:15:00.000
1
0
0
0
0
python,django
1
19,883,259
0
2
0
false
1
0
Simply the module won't be found when you try to run your project. You can run 'python' in your command line and try to 'import django' if it returns an error then django isn't found it means that django isn't installed on the current machine.
1
4
0
0
I've built a small project on my system. After building the project, I put it on a USB drive, and copied to another system. When I run the project, how can it detect if django is installed in the system or if the system has all of the the requirements for the project? For example, I made a blog example project on a laptop, then copied that project(blog) onto a USB drive and then I copied that project(blog) to my own system. After copying, I tried to run the project. If django is installed then the project runs successfully. But when django is not installed it gives an error in the terminal. How can the program detect if the required (Django/Python) is installed or not?
How can a django project detect if the system has django installed?
0
0.099668
1
0
0
262
19,896,965
2013-11-11T00:16:00.000
2
0
0
0
0
python,performance,wxpython,scintilla
0
19,897,133
0
1
0
true
0
1
Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero. Use LinesOnScreen() to determine how many lines are visible on the screen. You can use GetLine(line) to get a string of an individual line.
1
2
0
0
I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines? P.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks.
wxPython - StyledTextCtrl get currently visible lines
1
1.2
1
0
0
273
19,898,967
2013-11-11T04:42:00.000
3
0
0
0
0
python,flask,wtforms,flask-wtforms
0
25,145,753
0
2
0
false
1
0
A great question. This is what we do (flask backend, jquery frontend): use jquery.forms plugin to ajax forms. Pretty solid mature code. Shortcoming, cannot send json encoded data, only form-urlencoded. Receives plain or json data. use wtfroms for form validation. Very mature codebase. tried to use wtforms-json for accepting json, very screwy problems.
1
16
0
0
I accustomed of using WTForms by means of Flask-WTF in my flask application. Doing server side validation is trivial. But how do I leverage this server validation to become a field level, ajax, client side validation? So, when user tab to another input fields, my application can directly goes on validating it and give validation warning/info/error. I haven't found a resource in the internet yet
How to use WTForms in Ajax validation?
0
0.291313
1
0
0
8,644
19,913,092
2013-11-11T18:17:00.000
1
1
0
0
0
python,mocking,simulation,raspberry-pi,gpio
0
25,086,750
0
2
0
false
0
0
IF you just don't want to trust a software layer, you could try manually setting the pin high: The GPIO pins on the Raspberry Pi work with a voltage of 3.3VDC. Pins 1 & 17 on the P1-GPIO header outputs 3.3VDC. You could CAREFULLY try to connect a jumper from Pin 1 or 17 to the GPIO input pin you want to test. Connect it to test high, disconnect to test for low. MAKE SURE YOU DON"T USE THE 5VDC GPIO PINS, YOU COULD/WILL DAMAGE/KILL YOUR PI!
1
5
0
0
I'm new on Raspberry Pi and I would to know how can we simulate/mock the sensors (or GPIO) so I can test just my python code, mocking the Highs and Lows of the pins? Thanks in advance!
Simulate Raspberry Pi GPIO signal
0
0.099668
1
0
0
6,042
19,920,246
2013-11-12T03:18:00.000
0
0
1
0
0
python-2.7
0
19,920,270
0
2
0
false
0
0
Do you mean to tell you the last time you entered anything or a specific word? If it's a specific one, make a dictionary where you use words as keys, and then store the time there.
1
0
0
0
I have been recently working with Python, and I wish to make a program that tells me how long was the last time I inputted something without it closing (e.g. The first thing I input is the word "foo". After 15 minutes, I input foo again, so the program prints that I last inputted the word foo 15 minutes ago). Any ideas on how to make such a script? (Thanks in advance)
Permanent timer on Python
0
0
1
0
0
63
19,939,598
2013-11-12T20:50:00.000
0
0
0
0
0
python,qt,pyqt,pyqt4
0
19,943,638
0
1
0
false
0
1
The pyuic tool uses the objectName to generate the names of the top-level class and its members. So to make a member "private", just prepend some underscores to the objectName property in the designer component.
1
0
0
0
I've created a form in Qt Creator 4 and 'compile' it to python module with pyuic4. Everything is ok but when I call the class represented my for it contains over 20 form elements as a public members (including Spacers etc.). But I need only 5 of them. It's not fatal but annoying... Is there a way to declare an element in Qt Creator as private/hidden? I mean it has to be done in Qt Creator because if I'll make any changes and recompile .ui file all changes in .py file would be overwritten.
Qt Creator: how to hide members?
0
0
1
0
0
96
19,952,513
2013-11-13T11:25:00.000
0
0
1
0
0
asp.net,visual-studio-2010,ironpython
0
20,004,327
0
1
0
true
0
0
I found the solution just in case someone needs the same, for websites which is what I needed (for web applications is easier because there's an installable tool) Add a registry entry key ".py" in HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles.aspx
1
0
0
0
Is it possible to have .aspx and .aspx.py (IronPython codefile) nested underneath aspx files in VS 2010 ? I've seen some people added Windows registry entries for Visual Studio so other files would show up as nested underneath aspx, but I've no idea how to do it for IronPython if possible
Visual Studio file nesting aspx - aspx.py
1
1.2
1
0
0
64
19,962,699
2013-11-13T19:31:00.000
5
0
0
0
0
python,angularjs,flask,cors,flask-restful
0
47,288,580
0
9
0
false
1
0
Just an update to this comment. Flask CORS is the way to go, but the flask.ext.cors is deprecated. use: from flask_cors import CORS
2
47
0
0
I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale. I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right? Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API?
Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods
0
0.110656
1
0
1
58,328
19,962,699
2013-11-13T19:31:00.000
36
0
0
0
0
python,angularjs,flask,cors,flask-restful
0
28,923,164
0
9
0
false
1
0
You can use the after_request hook: @app.after_request def after_request(response): response.headers.add('Access-Control-Allow-Origin', '*') response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization') response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE') return response
2
47
0
0
I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale. I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right? Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API?
Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods
0
1
1
0
1
58,328
19,965,270
2013-11-13T22:00:00.000
1
0
1
0
0
python,django
0
19,967,173
0
1
0
false
0
0
They don't differ in performance at all.
1
1
0
0
I'm curious about this, from a performance point of view only, how do their differ considering the proper use?
Performance: Class Based Views VS Function Based Views
0
0.197375
1
0
0
346
19,975,234
2013-11-14T10:28:00.000
1
1
1
0
0
python,raspberry-pi,mqtt,mosquitto
0
19,975,285
0
2
0
false
0
0
If you are using pip, use pip freeze | grep 'python-mosquitto' to get the package version, and pip remove python-mosquitto to remove it.
1
0
0
0
How do I see what is the version of the python-mosquitto package used by my program? How do I find an old version of python-mosquitto (version 0.15) and remove it? I'm running on Raspberry Pi, raspian
how to find python-mosquitto version
0
0.099668
1
0
0
3,471
19,986,604
2013-11-14T19:29:00.000
1
0
0
0
0
python-2.7,hp-quality-center
0
19,987,148
0
1
0
false
0
0
I found an article by fijiaaron that let me know even if you/I have a 64 bit machine, we need the 32 bit version of Python installed, as soon as I installed the 32 bit version, I was able to see the print lines. Now on to the selenium...
1
0
0
0
I am familiar with Selenium using C# and integrating it with TeamCity - as a background. I am at a new company now. We have HP Quality Center and I saw a few articles how to use QC, Selenium, and Python Script to automate tests. I am having a major issue even getting a basic TDOutput.Print("test") to show up in the output log, unless I am wrong in expecting any TDOutput.Print lines to show up in that space. I have a Windows 7 box. The steps I have followed are: installed Python on my machine (2.7) installed steuptools installed pip I can install items using pip on the command line, including selenium In QC I create a new VAPI-XP test Choose PythonScript in the Wizard Then click Finish (and do not go any further on the wizard) Quality Center will then generate a skeleton script. In the skeleton, Under TDOutput.Clear(), I type: TDOutput.Print("Hello World") The output window never clears and it never prints "Hello World" This is what I see in output window: Test is completed Any suggestions on what easy step I have missed? I obviously do not have a lot of experience with this tool so its hard for me to see why I can't even get a print statement to execute - let alone worry about the selenium portion of my testing.
HP Quality Center Python Tests not executing any lines of script
0
0.197375
1
0
0
791
19,986,895
2013-11-14T19:45:00.000
0
0
1
1
0
python,python-3.x
0
19,987,194
1
2
0
false
0
0
instead of using python I typed python3 in terminal and it was the solution
1
0
0
0
I have mac os x, recently I have install python version 3.2 before I had version 2.6.1. but when I type "python" in terminal it prints Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49). what does it mean? how can I use python 3.2 that have install this week?
install new version of python
1
0
1
0
0
168
19,993,951
2013-11-15T05:08:00.000
2
0
0
0
1
python,django,rest,django-rest-framework
0
22,542,900
0
5
0
true
1
0
It turned out the problem was that I was using ListAPIView as the base class for my view class and it doesn't have the pre_save method defined. When I added some of the mixins which had it defined everything started working. Seems weird that something used in a lot of the basic tutorials doesn't support such a basic feature, but live and learn.
1
11
0
0
I need to attach a user to a request, this seems like a fairly common thing to need to do, but it's turning out to be damn near impossible. The docs for the Django REST Framework suggest using the pre_save method of the serializer class, which I did, but it doesn't get called when serializer.is_valid() is called, which makes it kind of worthless since without the user field the serializer fails validation. I've seen a few suggestions but they seem like crazy hacks and/or don't work. Plus, I feel like this is way too common of a task to really need all the stuff I see people suggesting. I can't be the only person to need to attach a user to a object created in a REST request.
Django REST Framework, pre_save() and serializer.is_valid(), how do they work?
0
1.2
1
0
0
9,143