Title
stringlengths
15
150
A_Id
int64
2.98k
72.4M
Users Score
int64
-17
470
Q_Score
int64
0
5.69k
ViewCount
int64
18
4.06M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
11
6.38k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
1
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
64
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
1.85k
44.1M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
0
1
Available Count
int64
1
17
Question
stringlengths
41
29k
Checking with Python3 if ZIP is installed on OS (Terminal)
21,941,266
0
0
34
0
python-3.x,operating-system,zip
You could check using the zipfile module. It will check for everything that is needed to run. If the OS version of zip is missing the import of the module will either fail (because it's missing) or the module works without the OS version (which should be fine too). I can't think of any other easy, portable approach. On UNIX systems you could just check if "zip" is found in the PATH but on windows it's not guaranteed that it is in the PATH.
0
1
0
0
2014-02-21T08:40:00.000
1
0
false
21,929,329
0
0
0
1
I try to work through Byte of Python3 and there is an example script for backing up folders and creating a zip file. I would like the script to check if zip is available within the os (Windows, Linux, Mac). Is there a way you can do this? Thanks, Mark
AppEngine real time querying - cost, performance, latency balancing act and quotas
21,962,823
0
1
173
1
python,google-app-engine,mapreduce,task-queue
First, writes to the datastore take milliseconds. By the time your user hits the refresh button (or whatever you offer), the data will be as "real-time" as it gets. Typically, developers become concerned with real-time when there is a synchronization/congestion issue, i.e. each user can update something (e.g. bid on an item), and all users have to get the same data (the highest bid) in real time. In your case, what's the harm if a user gets the number of check-ins which is 1 second old? Second, data in Memcache can be lost at any moment. In your proposed solution (update the datastore every 5 minutes), you risk losing all data for the 5 min period. I would rather use Memcache in the opposite direction: read data from datastore, put it in Memcache with 60 seconds (or more) expiration, serve all users from Memcache, then refresh it. This will minimize your reads. I would do it, of course, unless your users absolutely must know how many checkins happened in the last 60 seconds. The real question for you is how to model your data to optimize writes. If you don't want to lose data, you will have to record every checkin in datastore. You can save by making sure you don't have unnecessary indexed fields, separate out frequently updated fields from the rest, etc.
0
1
0
0
2014-02-21T17:23:00.000
2
0
false
21,941,030
0
0
1
1
I am trying to design an app that uses Google AppEngine to store/process/query data that is then served up to mobile devices via Cloud Endpoints API in as real time as possible. It is straight forward enough solution, however I am struggling to get the right balance between, performance, cost and latency on AppEngine. Scenario (analogy) is a user checks-in (many times per day from different locations, cities, countries), and we would like to allow the user to query all the data via their device and provide as up to date information as possible. Such as: The number of check-ins over the last: 24 hours 1 week 1 month All time Where is the most checked in place/city/country over the same time periods Where is the least checked in place over the same time periods Other similar querying reports We can use Memcache to store the most recent checkins, pushing to the Datastore every 5 minutes, but this may not scale very well and is not robust! Use a Cron job to run the Task Queue/Map Reduce to get the aggregates, averages for each location every 30 mins and update the Datastore. The challenge is to use as little read/writes over the datastore because the last "24 hours" data is changing every 5 mins, and hence so is the last weeks data, last months data and so on. The data has to be dynamic to some degree, so it is not fixed points in time, they are always changing - here in lies the issue! It is not a problem to set this up, but to set it up in an efficient manner, balancing performance/latency for the user and cost/quotas for us is not so easy! The simple solution would be to use SQL, and run date range queries but this will not scale very well. We could eventually use BigTable & BigQuery for the "All time" time period querying, but in order to give the users as real-time as possible data via the API for the other time periods is proving quite the challenge! Any suggestions of AppEngine architecture/approaches would be seriously welcomed. Many thanks.
Not being able to run pylint using windows (7) command prompt
21,945,800
1
3
4,751
0
python,pylint
set PATH=%PATH%;C:\python27\scripts is apparently what i needed to make it work... thanks for the path direction.
0
1
0
0
2014-02-21T20:23:00.000
1
0.197375
false
21,944,428
1
0
0
1
I've just installed all the dependencies (asteroid and logilab-commons) and pylint, ran the tests for pylint and they all passed, but i just cant get pylint to work... i keep getting 'pylint' is not recognized as an internal or external command, operable program or batch file. while running in the command prompt. im not sure what im doing wrong and i cant seem to find any explanation anywhere
How to install OpenERP on Mac OS X Mavericks?
22,423,411
1
2
7,748
0
python,macos,postgresql,openerp,openerp-7
Install PostgreSQL Create a user for OpenERP Install all dependencies for Python, using brew or MacPorts Download OpenERP and extract it Run the following command: cd openerp; python openerp-server
0
1
0
0
2014-02-22T05:32:00.000
2
1.2
true
21,950,193
0
0
0
1
I want to install OpenERP v7 on Mac OS X. How can I install it? I tried to install it brew install postgresql I succeed to install postgresql but when I create the user with following command createuser openerpI got the error like createuser:command not found I also got an error when I type psql.
Raspberry Pi (python) Run in background and reopen print output
21,953,931
0
0
655
0
python,printing,background,raspberry-pi
1) You should never run a script with sudo. You could potentially destroy your system. 2) Once your SSH session is closed all processes go with it. That is unless you use nohup or screen as you have found.
0
1
0
1
2014-02-22T09:56:00.000
1
0
false
21,952,650
0
0
0
1
I have learned online that there are several ways of running a python program in the background: sudo python scriptfile.py& sudo python scriptfile.py, then Control+Z, then bg Using nohup Using screen However, I would like to know if when doing any of the first two options, after I close and reopen SSH again, I can recover what the python program is internally printing by the print commands. So I run python and I start to see my print commands output, but if I close the SSH, even though the program is still running, I need to restart it in order to again see my print statements.
Error 404 when trying to access a Django app installed in a subdomain
21,969,799
0
0
718
0
python,django,.htaccess,subdomain,virtualenv
The issue was solved by contacting the support service and asking them to open the port 8000 for me.
0
1
0
0
2014-02-23T00:15:00.000
2
1.2
true
21,962,475
0
0
1
1
I just installed Django and create a project and an app following the basic tutorial part 1, I created a virtualenv since centOS default python version is 2.4.3, I also created a subdomain to work on this for the development phase. when I try to access like dev.domain.com/admin/ or dev.domain.com/ I get a 404 error, it's like django is not even there. When I run the server I get a normal response: (python2.7env)-bash-3.2# python manage.py runserver Validating models... 0 errors found February 22, 2014 - 23:54:07 Django version 1.6.2, using settings 'ct_project.settings' Starting development server at http://127.0.0.1:8000/ Any ideas what I'm missing? EDIT:after starting the server correctly(with the right ip) I tried again and as a result I got the browser hanging. Then I went to tried an online port scanner and found out that the port 8000 is not responding, any ideas what I can try next? Thanks
How to execute a python script and write output to txt file?
49,316,597
0
13
92,210
0
python,output
You could also do this by going to the path of the folder you have the python script saved at with cmd, then do the name.py > filename.txt It worked for me on windows 10
0
1
0
1
2014-02-23T02:09:00.000
8
0
false
21,963,270
0
0
0
2
I'm executing a .py file, which spits out a give string. This command works fine execfile ('file.py') But I want the output (in addition to it being shown in the shell) written into a text file. I tried this, but it's not working :( execfile ('file.py') > ('output.txt') All I get is this: tugsjs6555 False I guess "False" is referring to the output file not being successfully written :( Thanks for your help
How to execute a python script and write output to txt file?
33,993,200
2
13
92,210
0
python,output
The simplest way to run a script and get the output to a text file is by typing the below in the terminal: PCname:~/Path/WorkFolderName$ python scriptname.py>output.txt *Make sure you have created output.txt in the work folder before executing the command.
0
1
0
1
2014-02-23T02:09:00.000
8
0.049958
false
21,963,270
0
0
0
2
I'm executing a .py file, which spits out a give string. This command works fine execfile ('file.py') But I want the output (in addition to it being shown in the shell) written into a text file. I tried this, but it's not working :( execfile ('file.py') > ('output.txt') All I get is this: tugsjs6555 False I guess "False" is referring to the output file not being successfully written :( Thanks for your help
Python based asynchronous workflow modules : What is difference between celery workflow and luigi workflow?
25,704,688
27
37
8,450
0
python,celery,luigi
Update: As Erik pointed, Celery is better choice for this case. Celery: What is Celery? Celery is a simple, flexible and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. Why use Celery? It is simple to use & has lots of features. django-celery: provides good integration with Django. flower: Real-time monitor and web admin for Celery distributed task queue. Active & large community(based on Stackoverflow activity, Pyvideos, tutorials, blog posts). Luigi What is Luigi? Luigi(Spotify's recently open sourced Python framework) is a Python package that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization, handling failures, command line integration, and much more. Why use Luigi? Builtin support for Hadoop. Generic enough to be used for everything from simple task execution and monitoring on a local work station, to launching huge chains of processing tasks that can run in synchronization between many machines over the span of several days. Lugi's visualiser: Gives a nice visual overview of dependency graph of workflow. Conclusion: If you need a tool just to simply schedule tasks & run them you can use Celery. If you are dealing with big data & huge processing you can go for Luigi.
0
1
0
0
2014-02-23T11:08:00.000
2
1.2
true
21,967,398
0
0
1
2
I am using django as a web framework. I need a workflow engine that can do synchronous as well as asynchronous(batch tasks) chain of tasks. I found celery and luigi as batch processing workflow. My first question is what is the difference between these two modules. Luigi allows us to rerun failed chain of task and only failed sub-tasks get re-executed. What about celery: if we rerun the chain (after fixing failed sub-task code), will it rerun the already succeed sub-tasks? Suppose I have two sub-tasks. The first one creates some files and the second one reads those files. When I put these into chain in celery, the whole chain fails due to buggy code in second task. What happens when I rerun the chain after fixing the code in second task? Will the first task try to recreate those files?
Python based asynchronous workflow modules : What is difference between celery workflow and luigi workflow?
34,112,320
45
37
8,450
0
python,celery,luigi
(I'm the author of Luigi) Luigi is not meant for synchronous low-latency framework. It's meant for large batch processes that run for hours or days. So I think for your use case, Celery might actually be slightly better
0
1
0
0
2014-02-23T11:08:00.000
2
1
false
21,967,398
0
0
1
2
I am using django as a web framework. I need a workflow engine that can do synchronous as well as asynchronous(batch tasks) chain of tasks. I found celery and luigi as batch processing workflow. My first question is what is the difference between these two modules. Luigi allows us to rerun failed chain of task and only failed sub-tasks get re-executed. What about celery: if we rerun the chain (after fixing failed sub-task code), will it rerun the already succeed sub-tasks? Suppose I have two sub-tasks. The first one creates some files and the second one reads those files. When I put these into chain in celery, the whole chain fails due to buggy code in second task. What happens when I rerun the chain after fixing the code in second task? Will the first task try to recreate those files?
Running a Python Program Hiding the Source
21,978,072
2
0
121
0
python
There are plenty of ways someone can get your program, even if you remove the USB drive. They can install a program that triggers when a USB stick is inserted, search the stick for .py files, and copies them to disk. If the Python installation you're using is on the disk instead of the USB drive, they can replace the Python executable with a wrapper that saves copies of any file the Python interpreter opens. Your program is going to go into RAM, and depending on what it does and what else is using the machine, it may get swapped to disk. An attacker may be able to read your program out of RAM or reconstruct it from the swap file.
0
1
0
0
2014-02-24T02:41:00.000
2
1.2
true
21,977,987
1
0
0
2
When I run a program from a USB memory, and remove the USB memory the program still goes on running (I mean with out really copying the program into the Windows PC). However, does the program make its copy inside the Windows in any hidden location or temporary folder while running by the python IDLE. From where the python IDLE receive the code to be running after removing the USB memory? I am going to run python program in a public shared PC so I do not want anyone find out my code, I just want to run it, and get the result next day. Does someone can get my code even I remove the USB memory?
Running a Python Program Hiding the Source
21,978,357
0
0
121
0
python
It sounds like you are doing something you probably shouldn't be doing. Depending on how much people want your code they could go as far as physically freezing the ram and doing a forensic IT analysis. In short, you can't prevent code cloning on a machine you don't administer.
0
1
0
0
2014-02-24T02:41:00.000
2
0
false
21,977,987
1
0
0
2
When I run a program from a USB memory, and remove the USB memory the program still goes on running (I mean with out really copying the program into the Windows PC). However, does the program make its copy inside the Windows in any hidden location or temporary folder while running by the python IDLE. From where the python IDLE receive the code to be running after removing the USB memory? I am going to run python program in a public shared PC so I do not want anyone find out my code, I just want to run it, and get the result next day. Does someone can get my code even I remove the USB memory?
Global leaderboard in Google App Engine
21,979,231
0
3
930
0
python,google-app-engine,cron,leaderboard
Whether this is simpler or not is debatable. I have assumed that ranking is not just a matter of ordering an accumulation of points, in which case thats just a simple query. I ranking involves other factors rather than just current score. I would consider writing out an Event record for each update of points for a User (effectively a queue) . Tasks run collecting all the current Event records, In addition you maintain a set of records representing the top of the leaderboard. Adjust this set of records, based on the incoming event records. Discard event records once processed. This will limit your reads and writes to only active events in a small time window. The leader board could probably be a single entity, and fetched by key and cached. I assume you may have different ranking schemes like current active rank (for the current 7 days), vs all time ranks. (ie players not playing for a while won't have a good current rank). As the players view their rank, you can do that with two simple queries Players.query(Players.score > somescore).fetch(5) and Players.query(Players.score < somescore).fetch(5) this shouldn't cost too much and you could cache them.
0
1
0
0
2014-02-24T04:43:00.000
3
0
false
21,979,038
0
0
1
2
I want to build a backend for a mobile game that includes a "real-time" global leaderboard for all players, for events that last a certain number of days, using Google App Engine (Python). A typical usage would be as follows: - User starts and finishes a combat, acquiring points (2-5 mins for a combat) - Points are accumulated in the player's account for the duration of the event. - Player can check the leaderboard anytime. - Leaderboard will return top 10 players, along with 5 players just above and below the player's score. Now, there is no real constraint on the real-time aspect, the board could be updated every 30 seconds, to every hour. I would like for it to be as "fast" as possible, without costing too much. Since I'm not very familiar with GAE, this is the solution I've thought of: Each Player entity has a event_points attribute Using a Cron job, at a regular interval, a query is made to the datastore for all players whose score is not zero. The query is sorted. The cron job then iterates through the query results, writing back the rank in each Player entity. When I think of this solution, it feels very "brute force". The problem with this solution lies with the cost of reads and writes for all entities. If we end up with 50K active users, this would mean a sorted query of 50K+1 reads, and 50k+1 writes at regular intervals, which could be very expensive (depending on the interval) I know that memcache can be a way to prevent some reads and some writes, but if some entities are not in memcache, does it make sense to query it at all? Also, I've read that memcache can be flushed at any time anyway, so unless there is a way to "back it up" cheaply, it seems like a dangerous use, since the data is relatively important. Is there a simpler way to solve this problem?
Global leaderboard in Google App Engine
21,980,623
2
3
930
0
python,google-app-engine,cron,leaderboard
You don't need 50,000 reads or 50,000 writes. The solution is to set a sorting order on your points property. Every time you update it, the datastore will update its order automatically, which means that you don't need a rank property in addition to the points property. And you don't need a cron job, accordingly. Then, when you need to retrieve a leader board, you run two queries: one for 6 entities with more or equal number of points with your user; second - for 6 entities with less or equal number of points. Merge the results, and this is what you want to show to your user. As for your top 10 query, you may want to put its results in Memcache with an expiration time of, say, 5 minutes. When you need it, you first check Memcache. If not found, run a query and update the Memcache. EDIT: To clarify the query part. You need to set the right combination of a sort order and inequality filter to get the results that you want. According to App Engine documentation, the query is performed in the following order: Identifies the index corresponding to the query's kind, filter properties, filter operators, and sort orders. Scans from the beginning of the index to the first entity that meets all of the query's filter conditions. Continues scanning the index, returning each entity in turn, until it encounters an entity that does not meet the filter conditions, or reaches the end of the index, or has collected the maximum number of results requested by the query. Therefore, you need to combine ASCENDING order with GREATER_THAN_OR_EQUAL filter for one query, and DESCENDING order with LESS_THAN_OR_EQUAL filter for the other query. In both cases you set the limit on the results to retrieve at 6. One more note: you set a limit at 6 entities, because both queries will return the user itself. You can add another filter (userId NOT_EQUAL to your user's id), but I would not recommend it - the cost is not worth the savings. Obviously, you cannot use GREATER_THAN/LESS_THAN filters for points, because many users may have the same number of points.
0
1
0
0
2014-02-24T04:43:00.000
3
1.2
true
21,979,038
0
0
1
2
I want to build a backend for a mobile game that includes a "real-time" global leaderboard for all players, for events that last a certain number of days, using Google App Engine (Python). A typical usage would be as follows: - User starts and finishes a combat, acquiring points (2-5 mins for a combat) - Points are accumulated in the player's account for the duration of the event. - Player can check the leaderboard anytime. - Leaderboard will return top 10 players, along with 5 players just above and below the player's score. Now, there is no real constraint on the real-time aspect, the board could be updated every 30 seconds, to every hour. I would like for it to be as "fast" as possible, without costing too much. Since I'm not very familiar with GAE, this is the solution I've thought of: Each Player entity has a event_points attribute Using a Cron job, at a regular interval, a query is made to the datastore for all players whose score is not zero. The query is sorted. The cron job then iterates through the query results, writing back the rank in each Player entity. When I think of this solution, it feels very "brute force". The problem with this solution lies with the cost of reads and writes for all entities. If we end up with 50K active users, this would mean a sorted query of 50K+1 reads, and 50k+1 writes at regular intervals, which could be very expensive (depending on the interval) I know that memcache can be a way to prevent some reads and some writes, but if some entities are not in memcache, does it make sense to query it at all? Also, I've read that memcache can be flushed at any time anyway, so unless there is a way to "back it up" cheaply, it seems like a dangerous use, since the data is relatively important. Is there a simpler way to solve this problem?
How to make a task start right after another one finish in google app engine?
21,981,710
0
1
159
0
python,google-app-engine,task
It seems impossible to guarantee that B will be next.
0
1
0
0
2014-02-24T07:25:00.000
2
0
false
21,981,387
0
0
1
2
On taskqueue in gae. For example, I have task A, B. How to ensure that task B starts right after task A finishes. There could be other tasks, like C, to fix this problem. Also, 'right after' could be loose to 'after'. How about a dedicate queue with max_current_requests set to 1?
How to make a task start right after another one finish in google app engine?
21,982,975
2
1
159
0
python,google-app-engine,task
If you only have two tasks, you can start task B at the end of task A. For example, a task that updates user scores can start a task to send emails after it finished updating scores. In this case, you are guaranteed that task B is executed after task A, but there is no guarantee that there is no task C in between them - unless, of course, you don't have task C - or any other tasks - at all.
0
1
0
0
2014-02-24T07:25:00.000
2
0.197375
false
21,981,387
0
0
1
2
On taskqueue in gae. For example, I have task A, B. How to ensure that task B starts right after task A finishes. There could be other tasks, like C, to fix this problem. Also, 'right after' could be loose to 'after'. How about a dedicate queue with max_current_requests set to 1?
backing up data from app engine datastore as spreadsheet or csv
22,031,727
0
0
163
0
python,google-app-engine,google-cloud-datastore,app-engine-ndb
You need to take a look at the google spreadsheets api, google it, try it, come back when something specific doesnt work. Also consider using google forms instead which already do what you want (save responses to a spreadsheet)
0
1
0
0
2014-02-24T23:42:00.000
1
0
false
22,001,578
0
0
1
1
I am making a survay website on google app engine using Python. For saving the survey form data i am using NDB Datastore. After the survey I have to import it as spreadsheet or CSV. How can i do that. Thanks.
notify when execution/command is completed
22,021,547
0
21
8,943
0
ipython,anaconda
Recent versions of iTerm send notifications to notification center when there is output in a non-visible tab. They fold into notification center by default, but you can change them to stay on the screen in the Notifications preferences in System Preferences.
0
1
0
0
2014-02-25T04:09:00.000
5
0
false
22,004,386
1
0
0
1
How do I get IPython to notify me when a command has been executed? Can I get it to use the bell/alert, or by pop-up? I'm running Anaconda on iTerm on OS X 10.8.5.
Django - listening to rabbitmq, in a synchronized way. without celery. in the same process of the web bound django
32,414,239
2
2
1,008
0
python,django,rabbitmq
If anyone else bumps into this problem: The solution is using a RabbitMQ consumer from a different process (But in the same Django codebase) then Django (Not the running through wsgi, etc. you have to start it by it self) The consumer, connects to the appropriate rabbitmq queues and writes the data into the Django models. Then the usual Django process(es) is actually a "read model" of the data inserted/updated/created/deleted as delivered by the message queue (RabbitMQ or other) from a remote process.
0
1
0
0
2014-02-25T15:30:00.000
1
0.379949
false
22,018,798
0
0
1
1
I need to implement a quite simple Django server that server some http requests and listens to a rabbitmq message queue that streams information into the Django app (that should be written to the db). the data must be written to the db in a synchronized order , So I can't use the obvious celery/rabbit configuration. I was told that there is no way to do this in the same Django project. since Django would listen to http requests on It's process. and It can't handle another process to listen for Rabbit - forcing me to to add Another python/django project for the rabbit/db writes part - working with the same models The http bound django project works with.. You can smell the trouble with this config from here. .. Any Ideas how to solve this? Thanks!
How to make nbviewer display local files?
22,020,213
4
5
4,226
0
ipython-notebook
One minute later and it occurs to me that the front page might not support even though the server does. Sure enough, http://localhost:5000/localfile/PythonReference.ipynb?create=1 renders the local notebook.
0
1
0
0
2014-02-25T16:24:00.000
2
1.2
true
22,020,129
1
0
0
1
I've got nbviewer installed and working. I see it has a --localfiles option that takes a folder name. It says: "Serving local notebooks in /home/gb/S14/inclass, this can be a security risk" But I can't figure out the URL format to get it to look for the file there. The code adds a handler for /localfile/(.*) but that doesn't seem to get triggered. Anyone know how to format name to give to trigger loading a local file?
Is it possible to use dnspython through proxy?
22,074,588
0
0
1,227
0
python,proxy,dns,dnspython
If Google blocked that number of requests from a given IP address, one has to assume that sending such a number of requests is against their usage policy (and no doubt a form of 'unfair usage'). So hiding your source IP behind proxies is hardly ethical. You could adopt a more ethical approach by: Distributing your requests across a number of public DNS servers (search for 'public DNS servers', there 8 or 9 providers and at least 2 servers per providers), thus reducing the number of request per server. Spread your requests across a reasonable period of time to limit the effect of queries may have on the various providers' DNS servers. Or simply limit your query rate to something reasonable. If your requests cover a number of different domains, perform your own recursive resolution so that the bulk of your requests are targeted against the authoritative servers and not public recursive servers. This way, you would resolve the authoritative servers for a domain against the public servers (i.e. NS queries) but resolve CNAME queries against the authoritative server themselves, thus further spreading load. And there is no such thing as a DNS proxy (other than a DNS server which accepts recursive queries for which it is not authoritative).
0
1
1
0
2014-02-27T16:15:00.000
1
0
false
22,074,156
0
0
0
1
I'm writing a program which gathers basic CNAME information for given domains. I'm currently using Google's DNS server as the one I'm questioning, but afraid that if I'll send couple of millions DNS lookups this will get me blocked (Don't worry, it's by no means any type of DDOS or anything in that area). I'm wondering 2 things. 1. is it possible to use dnspython package to send requests through proxy servers? this way I can distribute my requests through several proxies. 2. I couldn't find a reference for a similar thing, but is it possible that I'll get blocked for so many DNS lookups? Thanks, Meny
Explicitly make a string into raw string
22,080,908
0
1
123
0
python,python-3.x
Your REGISTRY_KEY.strip() call is not doing what you think it's doing. It doesn't remove the string HKEY_LOCAL_MACHINE\ from the beginning of the string. Instead, it removes the characters H, K, E, etc., in any order, from both ends of the string. This is why it works when you manually put in what you expect. As for your original question, a double backslash is an escape sequence that produces a single backslash in your string, so it is not necessary to convert keyPath to double slashes.
0
1
0
0
2014-02-27T21:24:00.000
2
0
false
22,080,748
1
0
0
1
I am reading reading path to the registry from a text file. The registry path is HKEY_LOCAL_MACHINE\Software\MYAPP\6.3 I store this registry in a variable : REGISTRY_KEY Then I strip the HKEY_LOCAL_MACHINE part from the string and try to read the value at the key. if REGISTRY_KEY.split('\\')[0] == "HKEY_LOCAL_MACHINE": keyPath = REGISTRY_KEY.strip("HKEY_LOCAL_MACHINE\\") try: key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyPath) value = winreg.QueryValueEx(key, "InstallPath")[0] except IOError as err: print(err) I get the following error [WinError 2] The system cannot find the file specified However if I do it manually like key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,r'Software\MYAPP\6.3') OR key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,"Software\\MYAPP\\6.3") it works. So is there any way I can make the keyPath variable to either be a raw string or contain double '\' PS:I am using Python 3.3
Multiple storage engines for django media: prefer local, fallback to CDN
22,083,369
1
3
675
0
python,django,rackspace,mezzanine
The best way is to have this working, is to have a different web server serving all of your media (I used nginx). Then you setup a load balancer to detect failure and redirect all the requests to CDN in case of a failure. One thing that you might have to figure out is the image path.(use HAProxy to rewrite the request URL, if you need to)
0
1
0
0
2014-02-27T22:31:00.000
2
0.099668
false
22,082,005
0
0
1
1
I have a django/mezzanine/django-cumulus project that uses the rackspace cloudfiles CDN for media storage. I would like to automatically serve all static files from the local MEDIA_ROOT, if they exist, and only fallback to the CDN URL if they do not. One possible approach is to manage the fallback at the template level, using tags. I would prefer not to have to override all the admin templates (eg) just for this, however. Is there a way to modify the handling of all media to use one storage engine first, and switch to a second on error?
which is better way to run a file system monitoring service?
22,106,444
0
1
154
0
python,linux,filesystemwatcher,inotify
Create a script (you wouldn't need python for this task, just df and find). This is pretty lightweight, needs less code than a daemon (much less maintenance in the long run), and running scripts once a minute by cron is not unheard of. :-)
0
1
0
1
2014-02-28T18:32:00.000
1
1.2
true
22,103,096
0
0
0
1
I need to monitor NAS file system disk space, whenever file-system disk space goes above from a threshold value, I am I deleting oldest files from file system to bring back file system disk space below to threshold value. I read several article which suggested me two alternatives: by creating a daemon process which will run in background by creating a script and run through crontab which would be a better way to run a file system monitoring service? I need to run the monitoring script every 60 sec.For both options I will use python. it will run on *nix(unix/linux) environment.
In what order are PyDev project references, sourrce folders, and external libraries in the PYTHONPATH
28,799,767
2
1
340
0
python,eclipse,pydev
The PYTHONPATH in PyDev is computed in the following order: Source folders of the project have highest priority (since this is the code you're expecting to be editing). External source folders of the project being used for the launch. Computed PYTHONPATH of the dependent projects (again, first source then external). PYTHONPATH of the related interpreter selected. Note that the final sys.path is actually computed by Python itself (so, it may be a bit different depending on your Python version -- i.e.: it could add things from the current working dir, current module or eggs even if you remove it from what's configured in PyDev -- although for PyDev, modules not added won't be available for code completion and would be present as errors when searched for as they won't be indexed), PyDev only changes the PYTHONPATH environment variable to match the order presented above. If you somehow have a different outcome, please report this as a bug... (you can see what will be actually used before running in the launch run configuration > interpreter tab > see resulting command-line).
0
1
0
0
2014-03-01T11:45:00.000
1
0.379949
false
22,113,950
1
0
0
1
Using Eclipse with the PyDev plugin, if you choose myProject>Properties>PyDev-PYTHONPATH, you then see two tabs: Source Folders and External Libraries. You can also choose myProject>Properties>Project References and see a widget with a checkable list of other parallel subprojects in your Eclipse/Pydev IDE workspace. I understand that the values in these widgets configure the PYTHONPATH when you run your project. But the documentation does not seem to say the ordering of the values you specify. For example, are Project References values always after Source Folders and before External Libraries, in the generated PYTHONPATH? (That is the ordering I wish, so that I can Python install one of my subprojects, and my main project will find the installed version if I have turned off Project References, but my main project will find the same project from my workspace if I turn on a Project Reference to it, while I am changing and debugging the subproject.) Similarly (recursively) are the External Libraries of a Referenced Project inserted in the PYTHONPATH AFTER the Source Folder of a Referenced Project? It seems like my PYTHONPATH has site-packages external library directory BEFORE the source folder of my subproject, so Python never finds the development version of my subproject, only the subproject version as installed in site-packages. I have tried several times to 'Force restore internal info' and to restart Eclipse. I suppose I could have made a mistake somewhere outside of Eclipse.
Batch message from a rabbitMQ queue
22,134,400
6
6
4,628
0
python,rabbitmq
in general, the network aspect of "batching messages" is handled at the level of the basic.qos(prefetch-size, prefetch-count) parameters. In this scheme, the broker will send some number of bytes/messages(respectively) beyond the the unacknowledged messages for a consumer, but the client library doles out messages, in process, one at a time to the application. To maximize the benefit, the appication can withhold basic.ack() for each message, and periodically issue basic.ack(delivery-tag=n, multiple=True) to acknowledge all messages with a delivery tag <= n.
0
1
0
1
2014-03-02T22:02:00.000
1
1.2
true
22,134,173
0
0
0
1
I have a stream of requests in my RabbitMQ cluster, and multiple consumers handling them. The thing is - each consumer must handle requests in batches for performance reasons. Specifically there is a network IO operation that I can amortize by batching requests. So, each consumer would like to maximize the number of requests that it can batch, but not add too much latency. I could potentially start a timer when a consumer receives the first request and keep collecting requests until one of the two things happen - timer expires, or 500 requests have been received. Is there a better way to achieve this - without blocking each consumer?
How to use celery to get messages from a rabbit-mq server?
56,632,082
1
5
1,369
0
python,rabbitmq,celery
Celery can use several back-ends. If you are already using RabbitMQ, it makes that option attractive. These are however different concerns. Use a generic RabbitMQ client library such as pika to implement a consumer for your messages, then, if needed, use Celery to schedule tasks.
0
1
0
0
2014-03-03T12:34:00.000
3
0.066568
false
22,146,944
0
0
0
1
The celery docs suggest that Rabbit-MQ must act like a middleman, where it is used as a messaging platform. In my infrastructure, Rabbit-MQ is the primary server that serves me with some data every second. Now, whenever the data is served, I want Celery to do certain tasks. Now, this throws out the whole publisher-worker model, as we're not using Celery where the messages are being produced. So, how do I go about this?
pyw file not working intermittently / Task Scheduler
28,174,244
0
2
648
0
python,windows-7,scheduled-tasks,pythonw
I encountered a similar problem. While my code worked as expected using python.exe, it failed to work with pythonw.exe. After much debugging, I identified the source as a call to sys.stdout.write(). With pythonw.exe, sys.stdout is null, so the program crashes, but, silently. I wrapped that call in "if sys.stdout is not None" and the program started working with pythonw.exe as well.
0
1
0
0
2014-03-03T15:21:00.000
1
0
false
22,150,526
0
0
0
1
I've got a python script set to log in to a mail server and transfer the files to a remote directory mapped on my machine. Since I don't want it popping up every 10 minutes, I saved it as a pyw file. It worked fine at first, but then it stopped working, showing 0x1 as the result of the last run in the Windows Task Scheduler. When this happens I can execute the exact same code in a .py file and it works, but the .pyw file doesn't even if I run it manually. The pyw file only works again if I add an 'os.system("pause")' line to anywhere the code, which forces a command window to pop up for that line of code. If I take that line out again, it continues to work for the rest of the day, but then when I come in the next day it's stopped working again. I'm at wits' end on how to troubleshoot this. I'm not sure if it's an issue with pythonw, or something's going wrong with Windows Task Scheduler which is interfering with it, or something else.
how to load shell environment variables when Emacs starts py-shell?
22,208,324
0
1
392
0
python,bash,shell,emacs,ipython
After running your /etc/university/env.sh, start Emacs from this shell. Then the variables set before are known.
0
1
0
1
2014-03-04T14:56:00.000
2
0
false
22,175,349
0
0
0
1
I'm working for a university and they have their own libraries and paths for python libraries. Every time I start ipython, I need to run a shell script (e.g. /etc/university/env.sh) The problem is that emacs doesn't recognize the env.sh file. When I do py-shell, emacs always envokes Python WITHOUT any pre-set environment variables. Is there a way to make emacs run /etc/corporate/env.sh before starting python?
Is it possible to make ownership of /proc/pid/io follow changed process ownership?
22,176,917
0
0
35
0
python-2.7
That is by design. The process may still hold a capability (i.e. a handle to something external to the process) that would not be available to the process owner otherwise, so most debugging facilities are available to the root user only.
0
1
0
1
2014-03-04T15:28:00.000
1
0
false
22,176,118
0
0
0
1
One of my python scripts has to be started as root but after some initialization changes its process ownership to something else by calling setuid/setgid. Works like a champ except for one thing: most of the files under /prod/pid are still owned by root and most important /proc/pid/io is owned by root so I can't monitor that process's I/O stats. Might there be some additional calls I can make to change /proc ownership?
pyinstaller - mkdir error
22,179,885
0
0
417
0
python,pyinstaller
if the problem is indeed os.makedir you will need to run the program as administrator, or pick a non-protected folder to mkdir in ... Unfortunately is sounds like you are not sure this is the problem, if you build your executable with --console flag you will probably get output that tells you exactly what the problem is...
0
1
0
0
2014-03-04T18:13:00.000
2
0
false
22,179,731
1
0
0
2
I want to create executable with pyinstaller (in ubuntu). My program works, but when I create executable, program doesn't work. Problem is probably in command os.mkdir. How can I solve it? Thank you.
pyinstaller - mkdir error
22,179,931
0
0
417
0
python,pyinstaller
Hmm... If you want to create a directory where you want to store some files, you can create it by using os.system("mkdir $nameOfDirectory$"). Hope this helps, os.system() executes in Terminal the command between the paranthesis.
0
1
0
0
2014-03-04T18:13:00.000
2
0
false
22,179,731
1
0
0
2
I want to create executable with pyinstaller (in ubuntu). My program works, but when I create executable, program doesn't work. Problem is probably in command os.mkdir. How can I solve it? Thank you.
Installing Openpyxl for preinstalled python 2.7 mac lion
22,196,176
3
1
9,105
0
python-2.7,openpyxl
Install openpyxl using pip: sudo pip install openpyxl
0
1
0
0
2014-03-04T18:40:00.000
2
0.291313
false
22,180,238
0
0
0
1
I would like to install openpyxl-1.8.4 on Python 2.7 that comes with Mac Lion. My Python compiler is under system/library/Frameworks/Python.frameworks/Versions/2.7/bin. I tried python2.7 setup.py install and also sudo python2.7 setup.py install and seems to me none of them works. Am I missing something? I really appreciate your help. Thanks
Using php inside python code ,google app engine
22,183,262
2
1
361
0
php,google-app-engine,python-2.7
Those runtimes (Py, PHP, Java. etc.) are isolated from each other and are tightly sandboxed. So when you deploy a Python app, for example, it doesn't have access to the PHP or Java runtime. So, it's not possible to run PHP inside a python sandbox, at least not in the appengine platform.
0
1
0
1
2014-03-04T20:05:00.000
2
0.197375
false
22,181,860
0
0
1
1
I have a project that already written in php, and now i am using python in google app engine, actually i want to use the api that google support for python, for example : datastore, blobstore ... and also to save my time to re write the code again in python ! so, is it possible to run php script in python code ?
Releasing pygtk application
22,983,513
0
1
479
0
python,linux,pygtk
Just adding the solution to my own question! As suggested in the comments above installed packages by downloading the source and compiled them in a machine which had glibc2.5 then created binary executable of my pygtk app using pyinstaller I had tried compiling packages earlier also, but weren't checking the ./configure output properly. The problem was, I was trying to install gtk and pygtk without installing cairo and pango. So pygtk skipped building gtk packages because it did not find any cairo package. This was mentioned in the ./ configure script but I had not checked that. Summarizing: To configure pygtk to python need to folow these steps install sqlite-devel #If sqlite needed install python(2.7) install gtk(2.24.0) -> requires glib(2.27.3), atk(1.29.2), cairo(1.8.10), pango(1.22.4), gdk-pixbuf(2.21.3) install pygtk(2.24.0) -> requires pygobject-2.28.3, pycairo(1.8.10) All the above packages must be compiled to the same prefix, and need to set the PYTHON and PATHONPATH environment variables. The versions of packages also play major role. Added version in parenthesis that worked for me. There are many dependencies while installing some of the packages so I had to install following packages using yum: libxext, librender, gettext, zlib, libgtk2-devel
1
1
0
0
2014-03-05T07:34:00.000
1
1.2
true
22,191,409
0
0
0
1
I have developed a pygtk application and i need to release it to customers. I am using python 2.7, pygtk 2.2 in ubuntu. My question is how can I bundle the required packages(python, pygtk, gobject) together with my application, so that even if these packages are not installed in client machine I can run my application. I tried with pyinstaller but, the executable depends on the glibc i.e executable created with higher glibc version will not work with the machine which has lower glibc version. So is there any way to create a release directory which includes all the packages required so that I can run my application in any system without installing the packages. Thanks in advance,
Celery worker-offline event not generated
22,226,475
0
1
150
0
python,celery
After a bit of research, I ended up answering my own question: it was a bug which has been fixed in the later versions of celery.
0
1
0
0
2014-03-05T22:55:00.000
1
0
false
22,211,193
0
0
1
1
I am trying to capture the worker-related events, but there is something weird going on in my application: all the task events are being generated and captured and the worker events as well, except for worker-offline event. Is there any specific setting that I need to make for this event to be generated? I am using Celery 3.0.23
Cassandra 2.0.3 cqlsh Fail to start
22,231,783
0
0
784
0
python-2.7,cassandra,cqlsh
ValueError: invalid literal for int() with base10:'Unknown' It happens when you run Cassandra from sources, and version.properties file is missing. Just execute ant generate-eclipse-files in the cassandra folder, that will generate the file.
0
1
0
0
2014-03-06T05:31:00.000
1
1.2
true
22,215,833
0
0
0
1
I configured source code of Cassandra 2.0.3 in eclipse. JDK:jdk1.7.0_45 Win 7-32 bits, python 2.7.3 python but cqlsh just doesnt start. Please help me what can be the possible problem?
How to explain coroutine in Tornado and Python?
22,301,461
1
0
449
0
python,tornado,coroutine
gen.py does call send(), but in Runner.run(), not in engine() or coroutine() as you might expect. It seems that engine() and coroutine() basically evaluate the wrapped function to see whether it returns a generator. If it does, it calls Runner.run() on the result, which internally seems to loop over send(). It's not exactly obvious what it's doing though...
0
1
0
0
2014-03-06T09:47:00.000
2
1.2
true
22,220,635
1
0
0
1
I know coroutine in Python use get = yield ret , callee.send() , callee.next(). But I havn't find above things such as call.send() in Tornado Source code gen.py. How to explain coroutine in Tornado with an easy understand way? Without a Bigger picture, I just can't understand what Tornado did.
How to notify users in network
27,495,023
0
0
129
0
python,notify
Well ... I figured out that in my organization Microsoft Exchange will not allow email started from script except those originated from server. I handled to start email from server and now I'm all set. Thanks for suggestions. Ticket could be closed.
0
1
1
0
2014-03-07T00:41:00.000
1
1.2
true
22,239,230
0
0
0
1
I have a task to monitor disk usage and notify a few users when it runs out of space. I wrote python script that checks disk usage. Unfortunately I can't use email notification from the script because company policy does not allow it. My question: Are there any other options that would allow me to notify selected users in my network about particular event i.e. full disk space? I mean some kind of message that will pop-up on the screen or etc. Please keep in mind that I practically don't have any administrative privileges in the network. Thanks
Django Deployment on Linux Ubuntu
22,241,285
0
0
117
0
python,linux,django,ubuntu,django-deployment
Here is my stack: Nignx + gunicon, Supervisor Deployment, If you are planing frequent releases you should be looking at something like Fabric. Even of not frequent Fabric is a very good tool to be aware of. People have preference in terms of stack, but this one has been working great for me.
0
1
0
0
2014-03-07T03:46:00.000
1
1.2
true
22,241,028
0
0
1
1
I am going to seploy my first Django application to a cloud server like Amazon EC2 and the system is Linux Ubuntu. But I cannot find a very good step-by-step tutorial for the deployment. Could you recommend one? And I also have the following questions: What is the most recommended environment? Gunicorn, Apache+mod_python or ohters? How to deploy my code? I am using mac and should I use ftp or check out from my github repository? Thank you!
Homebrew brew doctor warning about /Library/Frameworks/Python.framework, even with brew's Python installed
22,355,720
36
73
45,838
0
python,macos,python-2.7,homebrew,brew-doctor
I also received this message. Something, sometime installed /Library/Frameworks/Python.framework on my machine (the folder date was about 4 years old). I've chosen to remove it. Please note that the Apple provided framework lives in /System/Library/Frameworks/Python.framework/
0
1
0
0
2014-03-07T16:33:00.000
6
1
false
22,255,579
1
0
0
1
When I ran Homebrew's brew doctor (Mac OS X 10.9.2), I get the following warning message: Warning: Python is installed at /Library/Frameworks/Python.framework Homebrew only supports building against the System-provided Python or a brewed Python. In particular, Pythons installed to /Library can interfere with other software installs. Therefore, I ran brew install and followed the steps provided in the installation's caveats output to install Homebrew's version of Python. Running which python confirms that Homebrew's version of it is indeed at the top of my PATH. Output is /usr/local/bin/python. Despite all this, when I rerun brew doctor, I am still getting the same warning message. How do I suppress this warning? Do I need to delete the /Library/Frameworks/Python.framework directory from my computer? Am I just supposed to ignore it? Is there a different application on my computer that may be causing this warning to emit? Note that I don't have any applications in particular that are running into errors due to this warning from brew doctor. Also note that this warning message didn't always print out when I ran brew doctor, it was something that started to appear recently. Also, I am using Python 2.7 on my computer, trying to stay away from Python 3.
execute python script from linux desktop
65,688,297
0
2
15,466
0
python,ubuntu
In my case it works after includes at the first line: #!/home/yourusername/anaconda3/bin/python You can check the appropiate path running which python in your console. It is also neccessary to change the file manager setting and configure it to run your scripts.
0
1
0
1
2014-03-07T22:39:00.000
5
0
false
22,262,073
0
0
0
1
I've created a simple python script and therefor have a .py file. I can run it from the terminal but if I double click it only opens up in gedit. I've read this question other places and tried the solutions, however none have worked. I'm running Ubuntu 13.04, I've selected the box to make the file executable. I've even installed a fresh instance of Ubuntu 13.10 on another computer and it does the same thing. What might I be missing here?
Duplicate App to an already existing ID on Google app engine
22,264,642
0
0
104
0
python,google-app-engine,blogs
You say you already used that id before. If you havent deleted that app just use that one to load your new code there. You will need to delete existing datastore data etc.
0
1
0
0
2014-03-07T23:04:00.000
2
0
false
22,262,420
0
0
1
1
I made a blog in Python and I am running it off of Google App Engine. When I started, I put a random ID, just because I was experimenting. Lately, my blog got a bit popular and I wanted to change the ID. I wanted to duplicate my app, but the problem is that I already registered that ID a while ago with google. How can I duplicate it even though the name already exists. Thanks, Liam
check directory free space on windows using python
22,263,086
0
0
102
0
python,space
This question doesn't make a lot of sense. Directories don't have "free space". As long as there is free space on the drive, you can use as much of it in a directory as you want.
0
1
0
0
2014-03-07T23:58:00.000
1
0
false
22,263,012
0
0
0
1
I have a task to check free space on particular directory on Windows. I figured out how to check for space of the drive. I was using ctypes module . Could you please help me to figure out which module or function should I use to get similar information for directory on Windows? Thanks
Space character in python that won't be interpreted by bash
22,276,497
0
3
288
0
python,bash,shell,ascii
Assuming that: you have control over ./main and that it is a shell script the entire output from the Python script is to be interpreted as a single parameter simply use $* rather than $1 inside ./main
0
1
0
0
2014-03-08T23:18:00.000
3
0
false
22,276,347
0
0
0
1
I have a Python script script.py which I am using to generate the command line argument to another script exactly like so: ./main $(./script.py) The output of script.py may contain spaces (e.g. foo bar) which are being unintentionally interpreted by the shell. I want the argument to ./main to be the single string "foo bar". Of course I can solve this problem if I quote the argument to ./main, like this: ./main "$(./script.py)" But I can't and don't want to do that. (The reason is because ./main is being called without quotes from another script which I don't have control to edit.) Is there an alternative representation of the space character that my Python script can use, and that bash won't interpret?
NDB validator argument vs extending base property classes
22,288,117
-1
0
138
0
python,google-app-engine,python-2.7,app-engine-ndb
It depends. Are the restrictions one-off or is any particular restriction going to be reused in many different fields/models? For one-off restrictions, the validator argument is simpler and involves less boilerplate. For reuse, subclassing lets you avoid having to repeatedly specify the validator argument.
0
1
0
0
2014-03-09T20:55:00.000
1
1.2
true
22,288,044
0
0
1
1
I'm using AppEngine NDB properties and I wonder what would be the best approach to: limit StringProperty to be not longer than 100 characters apply regexp validation to StringProperty prohibit IntegerProperty to be less than 0 Would it be best to use the validator argument or to subclass base ndb properties?
How do I activate a virtualenv inside PyCharm's terminal?
64,667,900
2
139
226,921
0
python,django,shell,virtualenv,pycharm
I had the same problem with venv in PyCharm. But It is not big problem! Just do: enter in your terminal venv directory( cd venv/Scripts/ ) You will see activate.bat Just enter activate.bat in your terminal after this you will see YOUR ( venv )
0
1
0
0
2014-03-09T21:43:00.000
29
0.013792
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
71,744,983
0
139
226,921
0
python,django,shell,virtualenv,pycharm
Had the same issue, this is how I solved it: All you gotta do is change the default terminal from Power shell to CMD. Open pycharm --> Go to Settings --> Tools --> Terminal. Change the Shell Path to C:\Windows\system32\cmd.exe from PS. Check the Activate virtualenv checkbox. Hit apply and open new terminal.
0
1
0
0
2014-03-09T21:43:00.000
29
0
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
70,631,199
0
139
226,921
0
python,django,shell,virtualenv,pycharm
Windows Simple and Easy Solution: In Pycharm inside the Projects menu on the left there will be folders. Find the Scripts folder Inside there you'll find activate.bat Right click on activate.bat Copy/Path Reference Select Absolute Path Find the Terminal tab located in the middle at the bottom of Pycharm. Paste it into the terminal console and press enter If you did it right the terminal path will have brackets (venv) around the name of the folder you activated. Before: "PS C:\" After: "(venv) C:\" Note The folder name may be different than yours the important part is the (brackets) :D
0
1
0
0
2014-03-09T21:43:00.000
29
0
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
52,873,952
3
139
226,921
0
python,django,shell,virtualenv,pycharm
On Mac it's PyCharm => Preferences... => Tools => Terminal => Activate virtualenv, which should be enabled by default.
0
1
0
0
2014-03-09T21:43:00.000
29
0.020687
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
37,982,649
1
139
226,921
0
python,django,shell,virtualenv,pycharm
If your Pycharm 2016.1.4v and higher you should use "default path" /K "<path-to-your-activate.bat>" don't forget quotes
0
1
0
0
2014-03-09T21:43:00.000
29
0.006896
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
27,075,910
1
139
226,921
0
python,django,shell,virtualenv,pycharm
I have a solution that worked on my Windows 7 machine. I believe PyCharm's terminal is a result of it running cmd.exe, which will load the Windows PATH variable, and use the version of Python that it finds first within that PATH. To edit this variable, right click My Computer --> Properties --> Advanced System Settings --> Advanced tab --> Environment Variables... button. Within the System variables section, select and edit the PATH variable. Here is the relevant part of my PATH before editing: C:\Python27\; C:\Python27\Lib\site-packages\pip\; C:\Python27\Scripts; C:\Python27\Lib\site-packages\django\bin; ...and after editing PATH (only 3 lines now): C:[project_path]\virtualenv-Py2.7_Dj1.7\Lib\site-packages\pip; C:[project_path]\virtualenvs\virtualenv-Py2.7_Dj1.7\Scripts; C:[project_path]\virtualenvs\virtualenv-Py2.7_Dj1.7\Lib\site-packages\django\bin; To test this, open a new windows terminal (Start --> type in cmd and hit Enter) and see if it's using your virtual environment. If that works, restart PyCharm and then test it out in PyCharm's terminal.
0
1
0
0
2014-03-09T21:43:00.000
29
0.006896
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
69,456,332
1
139
226,921
0
python,django,shell,virtualenv,pycharm
I had the similar problem of not having venv activated in pycharm terminal (Pycharm version 2021.2.2). Just simply follow the steps below. Go to "settings -> tools -> terminal" then at the bottom of that window check if "Activate virtualenv" is having a tick or not, if not then make sure that box is ticked. Then in the middle part of that window check the the shell path is set to "cmd.exe" or not, if not then set it to "cmd.exe" (it will have it's path associated with it so no need to do anything just click on "cmd.exe" from the drop down list) then click on "apply" button below and click "ok". Now it's done, just close your opened terminal and re-open it. You will see "venv" in front of your project path. P.S: Don't mind the double quotes in my answer they are just for highlighting the texts, nothing more.
0
1
0
0
2014-03-09T21:43:00.000
29
0.006896
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
69,724,636
11
139
226,921
0
python,django,shell,virtualenv,pycharm
Somehow a small trick worked for me. All you gotta do is change the default terminal from Power shell to CMD. Open pycharm --> Go to Settings --> Tools --> Terminal Change the Shell Path to C:\Windows\system32\cmd.exe from PS Check the Activate virtualenv checkbox Hit apply and open new terminal It's 2021 you don't need to specify the file path or add the environment variable. Update: It's 2022 and I run into the same issue Fix: Follow the above steps and in addition, make sure you have selected the Your virtual env python.exe as your project python interpreter, and that's it
0
1
0
0
2014-03-09T21:43:00.000
29
1
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
How do I activate a virtualenv inside PyCharm's terminal?
23,730,300
43
139
226,921
0
python,django,shell,virtualenv,pycharm
For Windows users when using PyCharm and a virtual environment under Windows, you can use the /k parameter to cmd.exe to set the virtual environment automatically. Go to Settings, Terminal, Default shell and add /K <path-to-your-activate.bat>. I don't have the reputation to comment on the earlier response so posting this corrected version. This really saves a LOT of time. Update: Note: Pycharm now supports virtual environments directly and it seems to work well for me - so my workaround not needed anymore.
0
1
0
0
2014-03-09T21:43:00.000
29
1
false
22,288,569
1
0
0
9
I've set up PyCharm, created my virtualenv (either through the virtual env command, or directly in PyCharm) and activated that environment as my Interpreter. Everything is working just fine. However, if I open a terminal using "Tools, Open Terminal", the shell prompt supplied is not using the virtual env; I still have to use source ~/envs/someenv/bin/activate within that Terminal to activate it. Another method is to activate the environment in a shell, and run PyCharm from that environment. This is "workable" but pretty ugly, and means I have major problems if I switch environments or projects from PyCharm: I'm now using the totally-wrong environment. Is there some other, much-easier way to have "Tools, Open Terminal" automatically activate the virtual environment?
Notify celery task to stop during worker shutdown
29,481,481
-2
4
1,753
0
python,celery
Celery is not intended to run long tasks cause it blocks the worker for your task only. I recommend re-arranging your logic, making the task invoke itself instead of making the loop. Once shutdown is in progress, your current task will complete and will resume right at the same point where it stopped before celery shutdown. Also, having task split into chunks, you will be able to divert the task to another worker/host which is probably what you would like to do in the future.
0
1
0
0
2014-03-10T13:16:00.000
2
-0.197375
false
22,301,208
0
0
0
1
I'm using celery 3.X and RabbitMQ backend. From time to time it needs to restart celery (to push a new source code update to the server). But there is a task with big loop and try/catch inside of the loop; it can takes a few hours to accomplish the task. Nothing critical will happen if I will stop it and will restart it later. QUESTION: The problem is every time after I stopped the workers (via sudo service celeryd stop) I have to KILL the task manually (via kill -9); the task ignores SIGTERM from worker. I've read throw Celery docs & Stackoverflow but I can't find working solution. Any ideas how to fix the problem?
How can I upload a static HTML to templates folder of GAE app?
22,304,153
0
0
60
0
java,python,google-app-engine
No you cant if you want to store them in static storage. You can store them somewhere non-static but you will lose the many advantages of having it as static content.
0
1
0
0
2014-03-10T14:07:00.000
1
0
false
22,302,439
0
0
1
1
Can I upload a static HTML file to templates folder without re-deploying the app? Offline I create an HTML file which I want to upload to my Google app engine app,which displays the HTML as per URLs. But I don't want to deploy my site every time I am uploading a new file. Any suggestion would be helpful.
The use of app.py.disabled on openshift
22,352,836
0
0
196
0
python-2.7,openshift,paas
I created a new gear with each cartridge type [python-2.6, python-2.7, python-3.3] and when the code was cloned to my workstation, none of them contained an app.py.disabled file. Can you give more information about how you created the application? Did you use a specific quickstart or url?
0
1
0
1
2014-03-11T07:43:00.000
2
0
false
22,319,312
0
0
0
1
I recently created a python app on openshift. I found a file called app.py.disabled when I git cloned the repo. Can anyone explain what it does?
How do I get a list of python libraries I've installed?
22,321,316
2
0
345
0
python,macos
Use pip list or install yolk with pip install yolk and then yolk -l.
0
1
0
0
2014-03-11T09:18:00.000
2
0.197375
false
22,321,243
1
0
0
1
I'm new to python, and I installed so many libraries, so I forgot what I installed and not. I'd like to get a list of libraries I've installed. Any help would be grateful. I'm using mac OS 10.9.2
Skipping stale data in a Twisted protocol handler
22,333,848
1
0
71
0
python,twisted
There aren't any peek-ahead APIs in Twisted that will let you know if there is data waiting in a buffer somewhere that's about to be delivered. I think your second idea is just fine - as long as you notice that you can pick an arbitrarily small constant delay. For example, you could pick 0 seconds. In practice this introduces a slightly longer delay (unless you have a really fast computer ;) but it's still small enough that you probably won't notice it. It's possibly also worth knowing that Twisted reactors try to interleave processing of time-based events with processing of file descriptor-based events. If you didn't know this then you might suspect that using reactor.callLater(0, f) would call f before any more I/O happens. While there's no guarantee of exactly how events are ordered, all of the reactors that ship with Twisted just go back and forth: process all I/O events, process all time events, repeat. And if you pick only a slightly larger value, perhaps 1/10th of 1 millisecond, then you can pretty much be sure that if dataReceived isn't called again before the timer expires there isn't any more locally received data that is about to be delivered to your application.
0
1
1
0
2014-03-11T17:17:00.000
1
1.2
true
22,331,935
0
0
0
1
I want to write a client for a protocol where the server sends length-prefixed data. The data requires nontrivial decoding and processing, and at any moment the client only needs the latest available data: if there is more data available, it's desirable to flush the old entries and use only the newest one. This is to avoid situations where the client spends so much time processing data that it starts getting more and more behind the server. I can easily implement reading the length-prefixed data with twisted.protocols.basic.IntNStringReceiver, but how would I check if there is more data available? What I would perhaps like to do is call select on the socket with a zero timeout to see if reading from the socket would block, and if not I'd just skip all decoding and processing. The socket is of course not available in the Protocol.dataReceived method call. Another idea would be to store the data somewhere and start a delay, and if the method is called again before the delay fires, overwrite the data. This imposes a constant delay even in the usual case where there is no more data available. Is there some way to do this that would fit well the Twisted programming model?
Storing song, artist and album data on App Engine
22,552,471
0
0
235
0
python,json,google-app-engine,app-engine-ndb
I would process the data from json, and place it in Model. As far as schema goes, you really need not worry about having redundancies as you cannot really think of the ndb as a relational database. So do not bother yourself too much about normalising the schema. But don't process on the client side, it is really not a good way to design it like that.
0
1
0
0
2014-03-11T22:27:00.000
2
0
false
22,338,014
0
0
1
1
I need to store information on artists, albums and songs in Google App Engine for a project I'm working on. The information is meta data taken from a directory of MP3s (using Python) that needs to be sent to App Engine for display to users. Along with the meta data, the song's path will need to be stored. Currently while scanning I'm storing the data in an list of dictionaries named Artists, each artist dictionary has a name and a list of Album dictionaries and each Album dictionary has a name and list of song dictionaries, each song then contains some meta data and the path to the MP3. I've been thinking of ways to store this data and have tried sending the data in JSON format to App Engine, then processing this into three models: Artist, containing the name and a repeated KeyProperty for each Album, Album then has a name and a repeated KeyProperty for each song and the song contains the rest of the meta data. Each of these will also contain a KeyProperty related the the Group that they belong to. The problems with this are: Lots of repeated data (Group Keys) and processing the data not only often exceeds the request deadline, but also uses an obscene amount of datastore writes. The only way I could think of to get around these problems would be to store the JSON provided after the scan as a JsonProperty and then pass this directly to the user for processing on the client side using JavaScript. The only issue I could see with that is that I don't particularly want to provide the path to the user (as this will need to be passed back and actioned on). Does anyone have experience using or storing this kind of data, or can provide any outside the box solutions?
Share file stream between Python and C
22,355,036
1
2
258
0
python,c,file
It should be possible. In C, you can get the file descriptor with fileno(fh) and open it in Python with os.fdopen(fd). Make sure you remember to close it -- I doubt that the Python file object going out of scope would accomplish this.
0
1
0
1
2014-03-12T14:39:00.000
1
0.197375
false
22,354,902
0
0
0
1
I've been trying to integrate C code into Python under Linux and I came up with the following problem: ¿is it possible to share an already opened file between C and Python? I mean a C FILE and a Python file object. The C function which I'm struggling with is called exhaustively, so I'd like to avoid opening/closing the file each time this happens and pass the opened file from Python to C. I'm open to any efficient solution.
Developing Linux Kernel Modules in Python
29,156,444
0
7
12,935
0
python,linux,linux-kernel,driver
No; LKM on Linux have to be compiled down do a specific ELF object code format. Of course you could make your own hack of Python that does compile down to kernel object code, but as far as I know, at this time there is no such Python publicly available.
0
1
0
0
2014-03-12T14:52:00.000
3
0
false
22,355,264
1
0
0
1
I have been wondering if developing Linux kernel modules (drivers) with Python is possible. Is it?
Query machine for hostname
22,358,568
3
1
218
0
python,linux,bash
You can remotely execute the command hostname command on these machines to acquire the Hostname
0
1
1
0
2014-03-12T16:54:00.000
1
0.53705
false
22,358,516
0
0
0
1
I want to be able to scan a network of servers and match IP addresses to hostnames. I saw a lot of questions about this (with a lot of down votes), but none are exactly what I'm looking for. So I've tried python's socket library socket.gethostbyaddr(ip). But this only returns results if I have a DNS setup or the IP-to-host mapping is in my hosts file. I want to be able to ask a machine for their hostname, rather than querying DNS. How can a query a Linux machine for their hostname? Preferably using python or bash, but other ways are good too.
How to set Python IDLE to use certain python version
22,358,774
2
0
271
0
python-3.x
Each installation of Python comes with its own respective version if IDLE. I suggest you explore your Python installation folder, and find the version of IDLE you're looking for and create a shortcut to it, or add it to your environment variable list, so you can invoke a specific version from the command line.
0
1
0
0
2014-03-12T17:01:00.000
1
1.2
true
22,358,713
1
0
0
1
I am using Windows 8. Python version 2.7.3 have been installed on my computer together with another software. Now I have installed python 3.3.5 and i want to use this version from now. But everytime I run Python IDLE it runs version 2.7.3. Even if I go to C:\Python33\Lib\idlelib\idle.pyw and run idle.pyw it runs with the 2.7.3 version. I thought that every python version install its own IDLE so I am quiet confused here. When I run Hello world program from the console it runs using the version 3.3.5 I have checked that. So what I need to do is to run IDLE using 3.3.5 version Anybody knows what to do?
can i serve PHP and python on a single project in app engine?
22,365,130
0
0
63
0
php,python,google-app-engine
You can (and many do) use a front-end like nginx or Apache that handles and forwards different paths differently. I do not see why you would want your application engine to be "bilingual" though.
0
1
0
1
2014-03-12T22:12:00.000
1
0
false
22,365,018
0
0
1
1
Can I serve PHP and python on a single project in app engine? for example /php/* will run php code, but the root / will run python code.
How to edit record in google datastore in AppEngine?
22,370,376
1
0
255
0
python,django,google-app-engine,gql
Fetch the record you want to edit (by key , id or any filter) , modify the field you want to edit and then put() it.
0
1
0
0
2014-03-13T04:56:00.000
1
1.2
true
22,369,384
0
0
1
1
I was create one app which have model and it was created but i facing problem how to edit data in google data store using python or Django. Please Help me.
Running homebrew while in a virtualenv
22,379,177
2
5
1,012
0
python,macos,virtualenv,homebrew
I don't think if they are related. You have to use pip for python package management when you use virtualenv. this way you make sure that your new stuff is on the sandbox you created. AFAIK home-brew installs stuff globally. So better not use it to get the python modules. hope it helps.
0
1
0
0
2014-03-13T12:45:00.000
2
1.2
true
22,379,103
1
0
0
1
Simple question: is running homebrew while in a virtualenv a bad idea? If so, is there any way that I can automatically deactivate the virtualenv each time I run a homebrew command? I don't trust myself to always remember to deactivate the virtualenv or open a new terminal window.
pkg_resources.resource_filename is not extracting files
22,385,552
3
4
5,826
0
python-3.x,setuptools,egg,python-egg-cache
Found the cause of the issue. As @erykson noted I was using the wrong directory. After replacing html_path = resource_filename(__name__, "html") with html_path = resource_filename(Requirement.parse("myproj"), "html") everything works fine.
0
1
0
0
2014-03-13T14:07:00.000
1
1.2
true
22,381,146
0
0
0
1
I want to package a project that contains (and uses) template html files and distribuite it as an egg. Since I’m using tornadoweb, which requires file paths to point to html files, I can’t access the resources via stream and I really need the html files to be extracted when my program is running. I’m having a look at setuptools and according to resource_filename docs (bold is mine): Sometimes, it is not sufficient to access a resource in string or stream form, and a true filesystem filename is needed. In such cases, you can use this method (or module-level function) to obtain a filename for a resource. If the resource is in an archive distribution (such as a zipped egg), it will be extracted to a cache directory, and the filename within the cache will be returned. If the named resource is a directory, then all resources within that directory (including subdirectories) are also extracted. If the named resource is a C extension or “eager resource” (see the setuptools documentation for details), then all C extensions and eager resources are extracted at the same time. Which seems exactly what I need. However this is not what happens on my machine. My setup.py contains the following line: data_files = [('html', ['html/index.html'])] And index.html is actually included in my egg file. When I run python3 setup.py install my project gets installed as a single zipped egg file. Unfortunately, when my program executes the following line: html_path = resource_filename(__name__, "html") I get the following return value: /usr/local/lib/python3.2/dist-packages/myproj-0.1-py3.2.egg/EGG-INFO/scripts/html/ The problem is that myproj-0.1-py3.2.egg is actually a zip file so this is not a valid path. It’s strange because if I call pkg_resources.get_cache_path(‘myproj’) I get the following path back: /root/.python-eggs/myproj-tmp But nothing is extracted there (yes, I’m running the program as root, but I’m just testing it). Any idea why my html directory is not extracted?
deleting rows in linux
22,392,153
0
0
115
0
python,linux,bash,file-io
There are various command line applications that would be able to accomplish this when working together. For example, you could cat all the files one after another, grep -v the patterns you don't want, redirecting >> to a new file. In effect this is doing the same thing as your Python script would do, because every line of every file must be copied (except the duplicates). It might be faster than Python, though, because those tools are written in C.
0
1
0
0
2014-03-13T21:54:00.000
4
0
false
22,391,805
0
0
0
1
I have a number of huge delimited text files containing information logged by date. Some of the files overlap slightly with each other by date (which I don't want since it leads to duplicates). I know what the overlapping dates are so I want to be able to go through some of the files and delete each of the rows that contains those specified dates. I know how to do this in python (rewriting each of the lines I want) but because of the size of the files (each is a few GBs) I was wondering if it would be a lot faster to do this through linux? The text files will be sorted by date, earliest to latest, and the dates I need to delete are always going to be in the beginning of the file so I can search until I hit a row that has a date right after the ones I want to delete and write out the rest of the file to another file (or delete all the contents above).
Running Python in PHP as a script in XAMPP (WINDOWS 8.1)
22,395,764
2
2
3,357
0
php,python-2.7,xampp,windows-8.1
I have finally figured this out: I will have to restart the server whenever I add a new cgi script in the server. This worked. In this case BridgePHP.py
0
1
0
1
2014-03-14T02:46:00.000
1
1.2
true
22,395,199
0
0
0
1
These are the actions that I have taken and I still can't seem to run the script on PHP on my windows 8.1 platform. Please do note that I have installed Python and have tested it. I am running python 2.7 (1) Step 1: Edited the Apache httpd.conf scripts to run cgi .py scripts AddHandler cgi-script .cgi .pl .asp .py (2) Step 2: Added a test script in cgi-bin folder of xampp. It is called #!/Python27/python print "Content-type: text/plain\n\n" print "Hello world" (3) Step 3: Created a PHP Code called Python.php $python = exec('python C:\xampp\cgi-bin\BridgePHP.py'); echo "Python is printing: " . $python; (4) I get the following output in my browser: Python is printing: (5) I tested by running using the standard command prompt and the word "Hello World" was printed I am unsure why php script is unable to run the python script. Is there any other settings that I should do?
how to install PIL on Macosx 10.9?
22,470,752
2
2
751
0
python,macos,python-imaging-library
following line helped me. sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pillow
0
1
0
0
2014-03-17T08:02:00.000
2
0.197375
false
22,449,304
0
0
0
1
When I try to install PIL library on Macosx 10.9.2, it's giving following error, how to install it. $: sudo pip install pillow cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -I/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/private/tmp/pip_build_root/pillow/libImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1
How can I directly open a custom file with python on a double click?
22,455,449
2
6
541
0
python,file,python-3.x,exe,cx-freeze
The only way Windows associates files with a particular program is by their extension, so this only works if your files have a unique extension (which it looks like maybe they do). So your user would need to setup the association on their machine, which varies depending on the version of Windows. For instance, in Windows 7 it would probably be through Control Panel\All Control Panel Items\Default Programs\Set Associations. It is possible for you to automatically setup this association on their system (probably by editing the Windows registry), but that would generally be done during an installation, and you should ask the users permission to do this first.
0
1
0
0
2014-03-17T13:16:00.000
2
0.197375
false
22,455,309
0
0
0
1
I am programming on a windows machine and I have an app that reads file selected by the user. Is it possible to allow them to open the file directly when they double click. This needs to work when the program is "compiled" as an .exe with cxfreeze. What I am really asking is this: Is there a way to allow the user to double click on a custom file (.lpd) and when they do windows starts the program (a compiled cxfreeze .exe) and passes it the file path as an argument.
Open python file with Task scheduler
22,519,416
1
1
359
0
python-2.7,batch-file,csv,task,scheduler
Assuming that you try this under the windows 7 Task-scheduler... You may try the following: In the security options of your Task (1st page) ensure that you have selected the SYSTEM account. Tick the high privileges check box near the bottom of the dialog (i guess you already did that) check if the file can be accessed (write into it with notepad) try to call the executable from the python processor directly with your script-file as an argument (maybe something went wrong with the inheritance of access rights when windows calls the python processor; assuming that you linked the .py file in the Task Scheduler) check the execution profile of the python command processor and compare it to the ownership of the CSV file (does the csv file reside in a user-account folder and has therefor other access requirements the python process can provide ? example: csv owned by user X, Task is run as user Y) you may also try to create a new, empty textfile somewhere else (C:) and fill the content in from the CSV greetings :)
0
1
0
0
2014-03-19T19:29:00.000
1
1.2
true
22,516,246
1
0
0
1
I have a .py file that reads integers from a separate csv , i just cant launch it from windows task scheduler, after 2 days and much frustration im posting here. A lot of similar questions have been posted but none are answered adequately for my case. I have no problems launching other python files or exe's, the problem arises when the python file needs to read a csv. I have turned the file into a batch file, and i have also went through every possible permutation of administration and permission options, but still no cigar. The problem stems solely from the fact that the python needs to call from an external csv. Has anyone got an opinion, or a work-around? Thanks.
Celery Flower - how can i load previous catched tasks?
22,554,555
2
1
1,345
0
python,celery,celery-task,flower
I found i out. It is the matter of setting the persistant flag in command running celery flower.
0
1
0
0
2014-03-21T08:26:00.000
1
1.2
true
22,553,659
0
0
0
1
I started to use celery flower for tasks monitoring and it is working like a charm. I have one concern though, how can i "reload" info about monitored tasks after flower restart ? I use redis as a broker, and i need to have option to check on tasks even in case of unexpected restart of service (or server). Thanks in advance
Python Anaconda - How to Safely Uninstall
50,594,422
3
275
666,412
0
python,anaconda
In case you have multiple version of anaconda, rm -rf ~/anaconda2 [for version 2] rm -rf ~/anaconda3 [for version 3] Open .bashrc file in a text editor vim .bashrc remove anaconda directory from your PATH. export PATH="/home/{username}/anaconda2/bin:$PATH" [for version 2] export PATH="/home/{username}/anaconda3/bin:$PATH" [for version 3]
0
1
0
0
2014-03-22T23:51:00.000
19
0.031568
false
22,585,235
1
0
0
4
I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anaconda directory? Any other changes required? Currently when I run which python I get this path: /Users/username/anaconda/bin/python
Python Anaconda - How to Safely Uninstall
68,270,547
0
275
666,412
0
python,anaconda
In macOs rm -rf ~/opt/anaconda3
0
1
0
0
2014-03-22T23:51:00.000
19
0
false
22,585,235
1
0
0
4
I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anaconda directory? Any other changes required? Currently when I run which python I get this path: /Users/username/anaconda/bin/python
Python Anaconda - How to Safely Uninstall
50,807,405
1
275
666,412
0
python,anaconda
To uninstall Anaconda Fully from your System : Open Terminal rm -rf ~/miniconda rm -rf ~/.condarc ~/.conda ~/.continuum
0
1
0
0
2014-03-22T23:51:00.000
19
0.010526
false
22,585,235
1
0
0
4
I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anaconda directory? Any other changes required? Currently when I run which python I get this path: /Users/username/anaconda/bin/python
Python Anaconda - How to Safely Uninstall
22,585,265
152
275
666,412
0
python,anaconda
The anaconda installer adds a line in your ~/.bash_profile script that prepends the anaconda bin directory to your $PATH environment variable. Deleting the anaconda directory should be all you need to do, but it's good housekeeping to remove this line from your setup script too.
0
1
0
0
2014-03-22T23:51:00.000
19
1
false
22,585,235
1
0
0
4
I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anaconda directory? Any other changes required? Currently when I run which python I get this path: /Users/username/anaconda/bin/python
Error in Python IDLE and shell while Proxifier is on
29,597,942
1
1
603
0
python,shell
I encountered the same problem. After trying a lot of things I arrived at this solution. The trick is to make a new Proxification Rule in proxifier. Name it anything you prefer, say PythonIdle. In application box add python.exe and pythonw.exe. Set action to Direct. Hope it will solves your problem!
0
1
0
0
2014-03-23T11:50:00.000
1
1.2
true
22,590,490
0
0
0
1
I have recently installed Python 2.7.6 in windows 7. When I tried to open the IDLE, it gave fatal errors. There are two error message popping up subsequently showing error messages: "IDLE Subprocess Error" "Socket Error:No connection could be made because the target machine actively refused it" "Subprocess Startup Error" "IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection." then nothing happens. I figured out that this error occurs only when Proxifier is on. No issue with firewall. I exited Proxifier and the python Shell was working fine. Then I tried to open Proxifier after opening shell. Then the shell immediately stopped compiling and running python code and hanged up. See if someone can help to get the shell work well while Proxifier is on, or any other suggestions.
Thumbor installation not working
23,401,532
1
0
3,567
0
python,ubuntu-12.04,thumbnails,thumbor
You are missing a closing bracket in the filters option in your thumbor.conf. Did you miss it posting here or actually in the thumbor.conf file?
0
1
1
0
2014-03-24T12:43:00.000
1
0.197375
false
22,609,742
0
0
0
1
I have followed the wiki and set up everything necessary, but all the images are broken right now. I used the aptitude package manager to install. Here are my configuration files: /etc/default/thumbor # set this to 0 to disable thumbor, remove or set anything else to enable it # you can temporarily override this with # sudo service thumbor start force=1 enabled=1 # Location of the configuration file conffile=/etc/thumbor.conf # Location of the keyfile which contains the signing secret used in URLs #keyfile=/etc/thumbor.key # IP address to bind to. Defaults to all IP addresses # ip=127.0.0.1 # TCP port to bind to. Defaults to port 8888. # multiple instances of thumbor can be started by putting several ports coma separeted # Ex: # port=8888,8889,8890 # or port=8888 #Default /etc/thumbor.conf #!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/globocom/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com # the domains that can have their images resized # use an empty list for allow all sources #ALLOWED_SOURCES = ['mydomain.com'] ALLOWED_SOURCES = ['admin.mj.dev', 'mj.dev', 'api.mj.dev', 's3.amazonaws.com'] # the max width of the resized image # use 0 for no max width # if the original image is larger than MAX_WIDTH x MAX_HEIGHT, # it is proportionally resized to MAX_WIDTH x MAX_HEIGHT # MAX_WIDTH = 800 # the max height of the resized image # use 0 for no max height # if the original image is larger than MAX_WIDTH x MAX_HEIGHT, # it is proportionally resized to MAX_WIDTH x MAX_HEIGHT # MAX_HEIGHT = 600 # the quality of the generated image # this option can vary widely between # imaging engines and works only on jpeg images QUALITY = 85 # enable this options to specify client-side cache in seconds MAX_AGE = 24 * 60 * 60 # client-side caching time for temporary images (using queued detectors or after detection errors) MAX_AGE_TEMP_IMAGE = 0 # the way images are to be loaded LOADER = 'thumbor.loaders.http_loader' # maximum size of the source image in Kbytes. # use 0 for no limit. # this is a very important measure to disencourage very # large source images. # THIS ONLY WORKS WITH http_loader. MAX_SOURCE_SIZE = 0 # if you set UPLOAD_ENABLED to True, # a route /upload will be enabled for your thumbor process # You can then do a put to this URL to store the photo # using the specified Storage UPLOAD_ENABLED = False UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage' UPLOAD_PUT_ALLOWED = False UPLOAD_DELETE_ALLOWED = False # how to store the loaded images so we don't have to load # them again with the loader #STORAGE = 'thumbor.storages.redis_storage' #STORAGE = 'thumbor.storages.no_storage' STORAGE = 'thumbor.storages.file_storage' #STORAGE = 'thumbor.storages.mixed_storage' # root path of the file storage FILE_STORAGE_ROOT_PATH = '/var/lib/thumbor/storage' # If you want to cache results, use this options to specify how to cache it # Set Expiration seconds to ZERO if you want them not to expire. #RESULT_STORAGE = 'thumbor.result_storages.file_storage' #RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 # one day #RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/result_storage' RESULT_STORAGE_STORES_UNSAFE=False # stores the crypto key in each image in the storage # this is VERY useful to allow changing the security key STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True #REDIS_STORAGE_SERVER_HOST = 'localhost' #REDIS_STORAGE_SERVER_PORT = 6379 #REDIS_STORAGE_SERVER_DB = 0 #REDIS_STORAGE_SERVER_PASSWORD = None # imaging engine to use to process images #ENGINE = 'thumbor.engines.graphicsmagick' #ENGINE = 'thumbor.engines.pil' ENGINE = 'thumbor.engines.opencv' # detectors to use to find Focal Points in the image # more about detectors can be found in thumbor's docs # at https://github.com/globocom/thumbor/wiki DETECTORS = [ 'thumbor.detectors.face_detector', 'thumbor.detectors.feature_detector', ] # Redis parameters for queued detectors # REDIS_QUEUE_SERVER_HOST = 'localhost' # REDIS_QUEUE_SERVER_PORT = 6379 # REDIS_QUEUE_SERVER_DB = 0 # REDIS_QUEUE_SERVER_PASSWORD = None # if you use face detection this is the file that # OpenCV will use to find faces. The default should be # fine, so change this at your own peril. # if you set a relative path it will be relative to # the thumbor/detectors/face_detector folder #FACE_DETECTOR_CASCADE_FILE = 'haarcascade_frontalface_alt.xml' # this is the security key used to encrypt/decrypt urls. # make sure this is unique and not well-known # This can be any string of up to 16 characters SECURITY_KEY = "thumbor@musejam@)!$" # if you enable this, the unencryted URL will be available # to users. # IT IS VERY ADVISED TO SET THIS TO False TO STOP OVERLOADING # OF THE SERVER FROM MALICIOUS USERS ALLOW_UNSAFE_URL = False # Mixed storage classes. Change them to the fullname of the # storage you desire for each operation. #MIXED_STORAGE_FILE_STORAGE = 'thumbor.storages.file_storage' #MIXED_STORAGE_CRYPTO_STORAGE = 'thumbor.storages.no_storage' #MIXED_STORAGE_DETECTOR_STORAGE = 'thumbor.storages.no_storage' FILTERS = [ 'thumbor.filters.brightness', 'thumbor.filters.contrast', 'thumbor.filters.rgb', 'thumbor.filters.round_corner', 'thumbor.filters.quality', 'thumbor.filters.noise', 'thumbor.filters.watermark', 'thumbor.filters.equalize', 'thumbor.filters.fill', 'thumbor.filters.sharpen', 'thumbor.filters.strip_icc', 'thumbor.filters.frame', # can only be applied if there are already points for the image being served # this means that either you are using the local face detector or the image # has already went through remote detection # 'thumbor.filters.redeye', URLs for images that I try to load look like this: http://localhost:8888/Q9boJke8j2p2Qtv53Hbz_g1nMZo=/250x250/smart/http://s3.amazonaws.com/our-company/0ea7eeb2979215f35112d2e5753a1ee5.jpg I have also setup a key in /etc/thumbor.key, please let me know if that's necessary to post here.
Query network device to determine operating system, without installing a remote agent?
22,610,165
0
0
83
0
python
Look up phrases like "port scan" and "port mapping" for some ideas. You'll need to make use of whatever services are already running on the target machine, which could include Avahi/Bonjour/mDNS, HTTP, SSH, SMTP, etc. You'd try to figure out what ports might be open, try to connect there (or send UDP datagrams), and see what you find. You could develop your own heuristics if you have enough devices or a small enough set you need to support, or you could probably find some existing code to do some of this (maybe not in Python directly though).
0
1
0
0
2014-03-24T12:50:00.000
1
1.2
true
22,609,931
0
0
0
1
I would like to query a device (e.g. an Android phone on WiFi) to find out what Operating System it is running, without having to run anything on the device or install an additional agent? Is this possible?
When I try to run 'cfx run' or 'cfx test' using the Mozilla Add-On SDK, my application binaries are not found
22,612,244
3
1
730
0
python,macos,firefox,firefox-addon,firefox-addon-sdk
It's looking for the Firefox binary file, not your application's binaries. You have to install Firefox because cfx run will open a browser with your add-on installed so you can use it and test it live. If firefox is already installed, then it is in a non-standar path, so you must tell cfx command where to find it, this way: cfx run -b /usr/bin/firefox or cfx run -b /usr/bin/firefox-trunk These examples are ony valid in some Linux distros like Ubuntu, you will have to find the firefox binary file in Mac OSX.
0
1
0
0
2014-03-24T13:19:00.000
1
1.2
true
22,610,616
0
0
1
1
I installed the the latest Add-On SDK by Mozilla (version 1.15). Installation was successful and when I execute cfx I get a list of all possible commands. I made a new separate empty folder, cd'd into it and ran cfx init. This was also successful and all necessary folders and files got created. Now when I try to run the extension or test it, I get the following error: I can't find the application binary in any of its default locations on your system. Please specify one using the -b/--binary option. I have tried looking up the docs to see what kind of file I should be looking for but was unsuccessful in solving the issue. I tried to create an empty bin folder within the add-on folder and i have tried initiating the template in different parents and sub-folders. I still get the same message. I'm running on a Mac, OSX Mavericks 10.9.1 What's going on here exactly?
Unzip all files in zip archive with inline command
22,614,609
1
0
174
0
python
I found the solution to be this: python -c "import zipfile;file=zipfile.ZipFile('archive.zip');file.extractall('.')" The contents of archive.zip will be placed into the directory this command is executed from.
0
1
0
0
2014-03-24T16:06:00.000
1
1.2
true
22,614,608
1
0
0
1
I have a zip file, but no unzipping tool installed. I do have python installed, but I can't easily create a python script file on this machine. How do I unzip the contents of the zip file using the python executable's -c argument?
launch a python program with it's arguments on cmd and get the output messages python
22,634,599
0
0
47
0
python
You can run any python command from cmd using Python.exe -c //code For example, Python.exe -c print(10*10) will print 100 to your console. Does this help? Your question is a little unclear, sorry.
0
1
0
0
2014-03-25T12:13:00.000
2
0
false
22,634,264
0
0
0
1
I would like to launch a python program.exe to test it from another python code i,e launch it on the cmd (myprogram.exe -a arg1 -b arg2) and eventually get the error message it can print or any console output does anyone have an idea how to do this? thanks EDIT Actually I launch it with os.popen(command) but what I want is to know if it ended with sys.exit or any exception or if it ended normally PS:I'm running python 2.6 (can't use subprocess.check_output ) Thanks
Loading python modules through a computing cluster
22,640,013
0
1
109
0
python,linux,bash
The submitted script is most likely using the system Python installation and not your own. Try submitting a shell script with only one command, which python, to confirm. The fix is to prepend the path to your Python interpreter to your system path. On my machine, the right Python is installed at /Users/mbatchkarov/anaconda/bin/python. I added export PATH="/Users/mbatchkarov/anaconda/bin:$PATH" to ~/.bash_profile EDIT Add the same line to ~/.bashrc.
0
1
0
1
2014-03-25T15:53:00.000
1
0
false
22,639,768
0
0
0
1
I have an account to a computing cluster that uses Scientific Linux. Of course I only have user access. I'm working with python and I need to run python scripts, so I need to import some python modules. Since I don't have root access, I installed a local python copy on my $HOME with all the required modules. When I run the scripts on my account (hosting node), they run correctly. But in order to submit jobs to the computing queues (to process on much faster machines), I need to submit a bash script that has a line that executes the scripts. The computing cluster uses SunGrid Engine. However when I submit the bash script, I get an error that the modules I installed can't be found! So my understanding to the problem is that the modules are not sent or something to the machine that executes the script. My question is: is it possible to include all the modules in the script or so? EDIT: I just created a bash script that runs which python and I noticed that the output was NOT my python copy. But when I run 'which python' on my ssh account, I get my python copy correctly..
Are queries on the "__key__" property strongly consistent with GAE datastore?
22,649,967
0
2
128
0
java,php,python,google-app-engine,go
A query will be consistent only on ancestor queries. Otherwise is not consistent even if the index contains key entries. This is because writes are applied in two phases, one to write your data and other to update indexes. Get by key neves uses an index so its always correct. I assume that you are generating semi-secuential keys otherwise a query with key wouldnt be useful. Beware however that appengine now recommends to spread your keys so they cover a large space and is thus better distributed in bigtable.
0
1
0
0
2014-03-25T22:16:00.000
1
1.2
true
22,647,454
0
0
0
1
I know generally queries on the GAE datastore are eventually consistent. However I don't see why queries on __key__ should not be strongly consistent as I presume this is what the datastore Get function uses. Can anyone confirm querying by __key__ is strongly consistent?
Loading python modules through a computing cluster
22,656,636
1
5
2,305
0
linux,python,distributed-computing
You could simply call your python program from the bash script with something like: PYTHONPATH=$HOME/lib/python /path/to/my/python my_python_script I don't know how SunGrid works, but if it uses a different user than yours, you'll need global read access to your $HOME. Or at least to the python libraries.
0
1
0
1
2014-03-25T16:01:00.000
3
0.066568
false
22,652,367
0
0
0
1
I have an account to a computing cluster that uses Scientific Linux. Of course I only have user access. I'm working with python and I need to run python scripts, so I need to import some python modules. Since I don't have root access, I installed a local python copy on my $HOME with all the required modules. When I run the scripts on my account (hosting node), they run correctly. But in order to submit jobs to the computing queues (to process on much faster machines), I need to submit a bash script that has a line that executes the scripts. The computing cluster uses SunGrid Engine. However when I submit the bash script, I get an error that the modules I installed can't be found! I can't figure out what is wrong. I hope if you can help.
how to invoke a terminal/powershell in a remote machine using python
22,659,787
0
0
103
0
python,django,terminal
The most secure way to execute functionality on a remote machine to use subprocess module to open a ssh session on the remote site, and remember to set up ssh on both machines, firewalls etc. When you start ssh you tell it what command to execute and the parameters for that command. I wouldn't open a general terminal session up that you type commands into - that sounds like a really bad idea. I am not going to include code here - for obvious reasons.
0
1
0
0
2014-03-26T06:38:00.000
1
0
false
22,653,330
0
0
0
1
am doing a project in Django I want to invoke a terminal in another machine to execute the code and how can I pass the the arguments to that terminal using python
High CPU usage for DJango 1.4 on Windows 2012
22,773,695
0
0
94
0
performance,python-2.7,32-bit,windows-server-2012
The issue was in 32-bit version of Python shipped with Zoo. Installing a 64-bit version and modifying the Zoo engine to use it, has boosted things significantly.
0
1
0
0
2014-03-27T06:26:00.000
1
1.2
true
22,679,857
0
0
1
1
We migrated to Helicon Zoo on Windows 2012 (from ISAPI on 2008). Problem is that the users started complaining about random slowdowns and timeouts with the application. The Python is 2.7 32-bit (due to Zoo requirements). That said, the problem is not Zoo related, as the runserver seems to exhibit same issues. The CPU shows to be the highest usage, practically reaching 80%-90% on every request. On Linux, same application works just fine. Are there any known caveats with Python 2.7 32-bit on Windows 2012?
are global variables visible to subprocess and changable by subprocess?
22,690,448
3
1
3,561
0
python,variables,subprocess,global
No, global variables are not visible to a sub-process. Variables are private to each process. If you want to share variables then you need to use some form of inter-process communication.
0
1
0
0
2014-03-27T14:19:00.000
3
0.197375
false
22,690,404
1
0
0
3
A quick question for Python 2.7 Are global variables visible to a subprocess? Can a subprocess change the values of global variables? Many thanks.
are global variables visible to subprocess and changable by subprocess?
22,690,516
2
1
3,561
0
python,variables,subprocess,global
The processes doesn't share the variables in a general operating system terms. Use some communication mechanism like message passing, shared memory etc to achieve the inter process communication.
0
1
0
0
2014-03-27T14:19:00.000
3
1.2
true
22,690,404
1
0
0
3
A quick question for Python 2.7 Are global variables visible to a subprocess? Can a subprocess change the values of global variables? Many thanks.
are global variables visible to subprocess and changable by subprocess?
22,858,917
0
1
3,561
0
python,variables,subprocess,global
Maybe the simplest way is write those into a file and read from the file in another process, although this might take extra time.
0
1
0
0
2014-03-27T14:19:00.000
3
0
false
22,690,404
1
0
0
3
A quick question for Python 2.7 Are global variables visible to a subprocess? Can a subprocess change the values of global variables? Many thanks.
How to check if there are errors in python
22,719,539
3
1
182
0
python,google-app-engine
If you are using the App Engine Launcher then by clicking on the Logs you can see all the logs and errors. An alternative way is to start the development server via the command line (as it's already mentioned) and you will see all the logs there, which makes it much easier to work with because the Logs windows is not that flexible.
0
1
0
0
2014-03-28T15:45:00.000
2
1.2
true
22,717,414
1
0
1
1
While using Google App Engine if there is an error in python the result is a blank page. It is difficult to debug python since you don't get line number on which there is error. It is extremely frustrating when you get blank page because of indentation error. Is there any way to execute python google app engine script in python interpreter so i get python error there itself.
How to release python script as a product?
22,725,485
1
1
622
0
python,pyinstaller
If you want no additional installation under every circumstance, one way or another you need to ship it with a python interpreter. So, in fact you are making the user install the interpreter in an unofficial fashion. Most linux distributions come with Python nowadays, and you would get problems originating of version conflict very rarely if executed under the same major version. I'd say, just chmod the file appropriately, set the shebang and ship it. If still insisting on your way, pyinstaller ought to have a way to bundle only the interpreter and binary dependencies together while having the original script stay in plain text, although I have done it under windows and not %100 percent sure it exists under linux.
0
1
0
0
2014-03-28T23:35:00.000
1
1.2
true
22,725,003
1
0
0
1
I'd like to release one python script to other users for Linux OS. I need to make sure the released script doesn't require other users to install the compatible version of python( maybe there is no python installed). This released script could also be modified and ran by other users. I tried pyinstaller. It gave me two options: 1, release an executable, but the executable is not modifiable. 2, release a directory(I'm not quite sure the method) with a spec file but it looks like very complicated. Is there any other better method I can release the script? Thanks,
Where can i find the deploy log in python app deployed in Openshift
22,736,609
1
0
127
0
python,django,logging,openshift
The deploy output is logged to stdout if I recall correctly. If you git push from the command line you should see where things are failing.
0
1
0
1
2014-03-28T23:40:00.000
1
1.2
true
22,725,031
0
0
0
1
I wanna be able to find the output text of the "deploy" script, that openshift calls automatically. Suppose I have the following line in that "deploy" script: python "$OPENSHIFT_REPO_DIR"wsgi/openshift/manage.py syncdb --noinput Then I wanna see the output text of that call... I already looked at the openshifthome/python/logs, and there are access* and error* logs, but there are no the ouputs that I want. I want this because some times, after I push to the master git branch, it fails, and I wanna know where it fails... Thanks
Get celery task ids in advanced workflow
22,898,676
0
1
998
0
python,celery
Solved by flagging ATask related model with aborted status flag and adding check at start of BTask.
0
1
0
0
2014-03-29T09:36:00.000
1
1.2
true
22,729,357
0
0
0
1
I need to realise following scenario: Execute task A Execute multiple task B in parallel with different arguments Wait for all tasks to finish Execute multiple task B in parallel with different arguments Wait for all tasks to finish Execute task C I have achieved this by implementing chain of chords, here is simplified code: # inside run() method of ATask chord_chain = [] for taskB_group in taskB.groups.all(): tasks = [BTask().si(id=taskB_model.id) for taskB_model in taskB_group.children.all()] if len(tasks): chord_chain.append(chord(tasks, _dummy_callback.s())) chord_chain.append(CTask().si(execution_id)) chain(chord_chain)() The problem is that I need to have ability to call revoke(terminate=True) on all BTasks in any point of time. The lower level problem is that I can't get to BTask celery ids. Tried to get BTask ids via chain result = chain(chord_chain)(). But I didn't found that information in returned AsyncResult object. Is it possible to get chain children ids from this object? (result.children is None) Tried to get BTask ids via ATask AsyncResult, but it seems that children property only contains results of first chord and not the rest of tasks. >>> r=AsyncResult(#ATask.id#) >>> r.children [<GroupResult: 5599ae69-4de0-45c0-afbe-b0e573631abc [#BTask.id#, #BTask.id#]>, <AsyncResult: #chord_unlock.id#>]
How to communicate between Django and Twisted when implementing a publish-subscribe pattern?
22,750,492
1
3
578
0
python,django,websocket,twisted,publish-subscribe
There are dozens or hundreds of ways to do inter-process communication. For example, you could use HTTP by running an HTTP server in one process and using an HTTP client in the other. The specific choice of protocol probably doesn't matter a whole lot. The particular details of the kind of communication you need might suggest one protocol over the others. If the extent of your requirements are just to provide notification that "something has happened" then a very simple protocol will probably do the job just fine.
0
1
0
0
2014-03-30T03:48:00.000
2
0.099668
false
22,740,033
0
0
1
1
I'm implementing a WebSocket server using Python and Autobahn (something that builds off of Twisted). What's the best way to let my Autobahn/Twisted server know that something has happened from within my Django application? More specifically, I'm implementing a notifications service and instant update service that automatically let's my client side application know when things have changed and what it needs to update. Is there any way to allow Django to "publish" to my Twisted server and then update the client side? I'm not really sure how this should all look. Thanks
Use production App Engine datastore on development machine?
22,772,893
2
0
334
0
python,google-app-engine
TL;DR: We do not support having the dev_appserver use the real app-engine datastore. Even with the suggested use of "remote_api", AFAIK, the dev_appserver does not know how to use it. If you really want to make this work, you could write your own low-level API and have your own datastore abstraction that uses your API instead of the actual datastore, however this is a non trivial amount of work. Another option is to have a servlet that can pre-populate your dev datastore with the data you need from checked in files. The checked in raw data could be non-real data or obfuscated real data. At dev_appserver startup, you hit this URL and your database becomes pre-populated with data. If you take this route, you get the bonus of not operating on your live data with dev code. HTH!
0
1
0
0
2014-03-31T15:22:00.000
2
1.2
true
22,765,563
0
0
1
1
Is it possible to setup the App Engine SDK on my local machine to use the live datastore while developing? Sometimes it's just easier for my workflow to work live. If not, is there an easy way to download or sync the live data to development machine? Thanks!
How can I specify a path on a Mac
22,774,906
0
1
186
0
python,macos,python-2.7,path
Another way is to set the PYTHONPATH environment variable to /User/username in your shell. Since you know about your shell, I expect that you already know how to edit your shell resource script. You could also add it to your .profile file in which case it should be available even if you change which shell you happen to be using.
0
1
0
0
2014-03-31T15:43:00.000
3
0
false
22,766,066
1
0
0
1
I'm using Python 2.7.2. and I want to open and use a dictionary I created in my shell. My problem is, when I try to import this dictionary into my shell it can't find the file because python is just looking into the 'my documents' folder. My question is, how can I navigate to the correct folder (just one folder further in 'my documents' folder. I am using a Macintosh.