Q_Id
int64 337
49.3M
| CreationDate
stringlengths 23
23
| Users Score
int64 -42
1.15k
| Other
int64 0
1
| Python Basics and Environment
int64 0
1
| System Administration and DevOps
int64 0
1
| Tags
stringlengths 6
105
| A_Id
int64 518
72.5M
| AnswerCount
int64 1
64
| is_accepted
bool 2
classes | Web Development
int64 0
1
| GUI and Desktop Applications
int64 0
1
| Answer
stringlengths 6
11.6k
| Available Count
int64 1
31
| Q_Score
int64 0
6.79k
| Data Science and Machine Learning
int64 0
1
| Question
stringlengths 15
29k
| Title
stringlengths 11
150
| Score
float64 -1
1.2
| Database and SQL
int64 0
1
| Networking and APIs
int64 0
1
| ViewCount
int64 8
6.81M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,635,443 |
2012-07-24T16:38:00.000
| 2 | 0 | 1 | 1 |
python,python-3.x
| 11,639,758 | 3 | false | 0 | 0 |
In Python things like this is generally so trivial that it's hard to even provide examples. Hooks are generally callbacks, yes. Callbacks in python are simply done by passing functions around and calling them.
| 1 | 6 | 0 |
In the world of penetration testing with Python, it looks like
one has to generally hook into an API that's OS specific. This makes sense
to me because we're dealing with different architectures and kernels between
OSX, Linux, Windows. But I'm wondering if this isn't the case?
Beyond some of the limited functionality you get out of the OS module, my assumption is that hooking into the OS's API is general going to be specific to *POSIX flavor (maybe they have more in common) than in Windows for example.
In particular I'm thinking of Deviare on Windows. It deals with .DLL files. That's pretty much Windows.
The moment we hear DLL, the mind goes to windows land, .plist OS X and so on.
|
Can API hooking in python be OS agnostic?
| 0.132549 | 0 | 0 | 6,564 |
11,638,579 |
2012-07-24T20:10:00.000
| 1 | 0 | 1 | 0 |
python
| 12,689,109 | 3 | false | 0 | 0 |
If some IDE interprets '####' as a half-baked string plus a comment, change the IDE!
| 1 | 2 | 0 |
I want to have a string containing 4 pound signs..how can I accomplish this in Python without commenting the string out due to the pound signs?
|
Using POUND SIGN as a string in PYTHON?
| 0.066568 | 0 | 0 | 17,557 |
11,639,235 |
2012-07-24T21:00:00.000
| 1 | 0 | 0 | 0 |
python,django-templates,apache2,django-views,locale
| 11,727,380 | 2 | true | 1 | 0 |
I managed to solve the problem by explicitly calling
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
I'm not sure why it wasn't working without the en_US.UTF-8 parameter as the local setting is 'en_US.UTF-8'. If anyone knows why I needed to use an explicit call when the apache process runs the code but not when I'm testing it anywhere else I'd still be interested in an answer, but I'll mark this as solved.
| 1 | 0 | 0 |
I've got a simple Ubuntu/django/apache server set up and I'm having trouble formatting some of the numbers that I want to display in my Django templates. When I run the code locally (i.e. on my work machine) using the Django test server everything formats with no problem.
Likewise, when I open up IDLE on the server I can do this:`
>>> import locale
>>> locale.setlocale(locale.LC_ALL,'')
'en_US.UTF-8'
>>> '{0:n}'.format(42424242)
'42,424,242'`
However whenever I try to run the apache server and test the code live it fails and I get outputs like:
'42424242'
I prepended a print statement to the
locale.setlocale(locale.LC_ALL,'')
call that have in my view.py file and all I found in the apache error log was
[Tue Jul 24 15:26:56 2012] [error] C
Could it be that the apache process doesn't have permissions to access the native locale setting?
|
python locale.setlocale fails when running apache
| 1.2 | 0 | 0 | 958 |
11,641,077 |
2012-07-25T00:17:00.000
| 1 | 1 | 1 | 0 |
python,physics,game-physics
| 11,641,106 | 2 | false | 0 | 0 |
Assuming that you've got an in-game quantized unit of time, a "tick" of the clock, if you will, give each body a velocity vector (how much, and in which directions, it moves per "tick") and for each tick, have each other body change its velocity vector by some amount based on their distance (exert a force on it, divided by its mass). Then, whenever your clock ticks, the bodies move according to their velocity vectors, and then their velocity vectors changed based on the net force on them. As long as you decide which happens first - acceleration or motion - provided that your ticks are small enough, you should be fine.
| 2 | 3 | 0 |
I'm writing a 2D game in Python that has gravity as a major mechanic.
I have some of the game engine made, but the part where I'm stuck is actually determining what to add to the X and Y velocities of each mass.
So say I have circle A and circle B, each with a position, a velocity, and a mass. Each should be pulled towards the other fairly realistically, simulating Newtonian gravity. How would I achieve this?
Yes, I am being very ambiguous with the units of measurement. Later I can experiment with changing the variables to fit the formula.
|
Newtonian gravity simulation
| 0.099668 | 0 | 0 | 1,914 |
11,641,077 |
2012-07-25T00:17:00.000
| 3 | 1 | 1 | 0 |
python,physics,game-physics
| 11,641,140 | 2 | true | 0 | 0 |
You need to solve the equations of motion for each body. They'll be written as a set of coupled, first-order, ordinary differential equations. You'll write one equation each for the x- and y-directions, which will give you the acceleration as a function of the gravitational force between the two bodies divided by their respective masses.
You know the relationships between acceleration, velocity, and displacement.
You end up four coupled ordinary differential equations to solve. Use a time stepping solution to advance the solution in time - explicit or implicit, your choice.
| 2 | 3 | 0 |
I'm writing a 2D game in Python that has gravity as a major mechanic.
I have some of the game engine made, but the part where I'm stuck is actually determining what to add to the X and Y velocities of each mass.
So say I have circle A and circle B, each with a position, a velocity, and a mass. Each should be pulled towards the other fairly realistically, simulating Newtonian gravity. How would I achieve this?
Yes, I am being very ambiguous with the units of measurement. Later I can experiment with changing the variables to fit the formula.
|
Newtonian gravity simulation
| 1.2 | 0 | 0 | 1,914 |
11,642,105 |
2012-07-25T03:04:00.000
| 0 | 0 | 1 | 0 |
python,time
| 11,642,138 | 3 | false | 0 | 0 |
For a database, your best bet is to store it in the database-native format, assuming its precision matches your needs. For a SQL database, the DATETIME type is appropriate.
EDIT: Or TIMESTAMP.
| 2 | 0 | 0 |
I am wondering what the most reliable way to generate a timestamp is using Python. I want this value to be put into a MySQL database, and for other programming languages and programs to be able to parse this information and use it.
I imagine it is either datetime, or the time module, but I can't figure out which I'd use in this circumstance, nor the method.
|
Most reliable way to generate a timestamp with Python
| 0 | 1 | 0 | 390 |
11,642,105 |
2012-07-25T03:04:00.000
| 0 | 0 | 1 | 0 |
python,time
| 11,642,253 | 3 | false | 0 | 0 |
if it's just a simple timestamp that needs to be read by multiple programs, but which doesn't need to "mean" anything in sql, and you don't care about different timezones for different users or anything like that, then seconds from the unix epoch (start of 1970) is a simple, common standard, and is returned by time.time().
python actually returns a float (at least on linux), but if you only need accuracy to the second store it as an integer.
if you want something that is more meaningful in sql then use a sql type like datetime or timestamp. that lets you do more "meaningful" queries (like query for a particular day) more easily (you can do them with seconds from epoch too, but it requires messing around with conversions), but it also gets more complicated with timezones and converting into different formats in different languages.
| 2 | 0 | 0 |
I am wondering what the most reliable way to generate a timestamp is using Python. I want this value to be put into a MySQL database, and for other programming languages and programs to be able to parse this information and use it.
I imagine it is either datetime, or the time module, but I can't figure out which I'd use in this circumstance, nor the method.
|
Most reliable way to generate a timestamp with Python
| 0 | 1 | 0 | 390 |
11,643,221 |
2012-07-25T05:21:00.000
| 0 | 0 | 0 | 0 |
python,user-interface,icons,pyqt,pyside
| 11,693,002 | 8 | false | 0 | 1 |
in PyQt, the window icon is by default the Qt logo. I think you will have to find your own icons for things inside the gui.
| 1 | 28 | 0 |
I'm reading a tutorial on PySide and I was thinking , do I need to find my own icons for every thing or is there some way to use some built in icons . That way I wouldn't need to find an entire new set of icons if I want my little gui to run on another desktop environment .
|
Are there default icons in PyQt/PySide?
| 0 | 0 | 0 | 30,098 |
11,644,808 |
2012-07-25T07:35:00.000
| 0 | 0 | 0 | 1 |
python,linux,ssh,console
| 11,663,302 | 2 | true | 0 | 0 |
I have seen that indeed screen does what i need...
Thanks Ignacio
| 2 | 0 | 0 |
I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all the shell where I am logged with the same username of the one who launched the process?
Alternatively I thought of redirecting the output to a file and open this file… however I would prefer avoiding such a solution.
Thanks in advance for any suggestion…
|
Output of a process displayed in multiple consoles
| 1.2 | 0 | 0 | 234 |
11,644,808 |
2012-07-25T07:35:00.000
| 0 | 0 | 0 | 1 |
python,linux,ssh,console
| 11,645,207 | 2 | false | 0 | 0 |
In UNIX you could write to all shells using the command wall. I'm not sure if there is a Python binding for wall though.
| 2 | 0 | 0 |
I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all the shell where I am logged with the same username of the one who launched the process?
Alternatively I thought of redirecting the output to a file and open this file… however I would prefer avoiding such a solution.
Thanks in advance for any suggestion…
|
Output of a process displayed in multiple consoles
| 0 | 0 | 0 | 234 |
11,645,123 |
2012-07-25T07:56:00.000
| 1 | 0 | 0 | 0 |
python,winapi,google-chrome
| 57,915,124 | 3 | false | 0 | 0 |
I quite new to StackOverFlow so apologies if the comment is out of tone.
After looking at :
Selenium,
launching chrome://History directly,
doing some keyboard emulation : copy/paste with Pywinauto,
trying to use SOCK_RAW connections to capture the headers as per the Network tab of the DevTool (this one was very interesting),
trying to get text of the omnibus/searchBar window element,
closing and reopening chrome to read the history tables,
....
I resulted in copy/pasting the History file itself (\AppData\Local\Google\Chrome\User Data\Default\History) into my application folder when the title of the window (retrieved using the hwnd + win32) is missing from "my" urls table.
This can be done even if the sqlite db is locked and does not interfere with the user experience.
Very basic solution that requires : sqlite3, psutil, win32gui.
Hope that helps.
| 1 | 12 | 0 |
How can my Python script get the URL of the currently active Google Chrome tab in Windows? This has to be done without interrupting the user, so sending key strokes to copy/paste is not an option.
|
How do I get the URL of the active Google Chrome tab in Windows?
| 0.066568 | 0 | 1 | 13,519 |
11,645,451 |
2012-07-25T08:17:00.000
| 0 | 1 | 0 | 0 |
python,selenium,windmill,browser-testing
| 12,344,550 | 1 | false | 1 | 0 |
If you're looking to run Windmill in headless mode (no monitor) you can do it by running
Xvfb :99 -ac &
DISPLAY=:99 windmill firefox -e test=/path/to/your/test.py
| 1 | 1 | 0 |
In selenium testing, there is htmlunitdriver which you can run tests without browser with. I need to do this with windmill too. Is there a way to do this in windmill?
Thank!
|
Windmill-Without web browser
| 0 | 0 | 1 | 364 |
11,645,609 |
2012-07-25T08:28:00.000
| 1 | 0 | 1 | 0 |
python,exception,import,dependencies
| 11,645,654 | 1 | true | 0 | 0 |
Not really. But if the optional import fails then you could provide "stub" classes which would explain the error if instantiated.
| 1 | 0 | 0 |
I am creating a package in python, that has some optional dependencies. These dependencies are not required for core features but their lack will disable use of some class (it is an orm which offers a field for storing html. lxml is used to store and retrieve the value).
Obviously I may just not create the class if the dependency cannot be imported. But this could be confusing for the user, as he gets 'module x has no attribute y' which is not the real problem.
So is there any way to issue the meaningful error message if someone wants to import or use a class (I was also thinking about creating a class with __getattribute__ raising error). Is there any recommended way to do it? Some interesting way it was done in some high-quality package?
|
An informative way to show a lack of optional dependency in python
| 1.2 | 0 | 0 | 103 |
11,646,830 |
2012-07-25T09:35:00.000
| 1 | 0 | 0 | 1 |
python,jenkins,jython,nose
| 11,650,753 | 2 | false | 1 | 0 |
There is no way to achieve this from your tests. The report generator simply won't display the output unless there are errors.
You will have to get the sources for Jenkins itself (the JUnit runner is built into it) and patch the reporter or write your own plugin.
| 2 | 2 | 0 |
I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose with --nocapture. However this results in all the output beeing under the projects console log that jenkins creates by default. How I tell nose/capture to append the captured output to each test result shown in Jenkins?
I use xunit to generate a junit compatible xml file which is in turn used by Jenkins to generate its reports.
edit: Additional Infos as requested
Url in Jenkins (after buildnumber part):
/testReport/testDesignParser.testDesignCsvParser.testDesignCsvParser/testDesignCsvParser/test/?
I know that this design is not pretty but thats how it is now. If it matters:
`testDesignParser.testDesignCsvParser.testDesignCsvParser` module
`testDesignCsvParser` class
`test` (member)testfunction
|
Add logging to tests results in jenkins
| 0.099668 | 0 | 0 | 3,561 |
11,646,830 |
2012-07-25T09:35:00.000
| 2 | 0 | 0 | 1 |
python,jenkins,jython,nose
| 11,742,115 | 2 | true | 1 | 0 |
With the latest Jenkins there is an option to save the output (Retain long standard output/error) right under the post build step belonging to JUnit. Additionally I run nose with --nocapture. This gives me a console output view on every test (an option on the left menu when I have a test opened)
| 2 | 2 | 0 |
I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose with --nocapture. However this results in all the output beeing under the projects console log that jenkins creates by default. How I tell nose/capture to append the captured output to each test result shown in Jenkins?
I use xunit to generate a junit compatible xml file which is in turn used by Jenkins to generate its reports.
edit: Additional Infos as requested
Url in Jenkins (after buildnumber part):
/testReport/testDesignParser.testDesignCsvParser.testDesignCsvParser/testDesignCsvParser/test/?
I know that this design is not pretty but thats how it is now. If it matters:
`testDesignParser.testDesignCsvParser.testDesignCsvParser` module
`testDesignCsvParser` class
`test` (member)testfunction
|
Add logging to tests results in jenkins
| 1.2 | 0 | 0 | 3,561 |
11,647,112 |
2012-07-25T09:52:00.000
| 0 | 0 | 0 | 0 |
python,search,solr
| 11,679,439 | 4 | false | 0 | 0 |
Besides DIH, you could setup a trigger in your db to fire Solr's REST service that would update changed docs for all inserted/updated/deleted documents.
Also, you could setup a Filter (javax.servlet spec) in your application to intercept server requests and push them to Solr before they even reach database (it can even be done in the same transaction, but there's rarely a real need for that, eventual consistency is usually fine for search engines).
| 1 | 1 | 0 |
I am building a system where entries are added to a SQL database sporadically throughout the day. I am trying to create a system which imports these entries to SOLR each time.
I cant seem to find any infomation about adding individual records to SOLR from SQL. Can anyone point me in the right direction or give me a bit more information to get me going?
Any help would be much appreciated,
James
|
SOLR - Adding a single entry at a time
| 0 | 1 | 0 | 606 |
11,647,268 |
2012-07-25T10:00:00.000
| 0 | 0 | 0 | 0 |
python,python-2.7,activemq
| 11,719,245 | 2 | false | 0 | 0 |
Finally I am using STOMP python for listening to a ActiveMQ Broker. PyActiveMq is to unstable to be used as it is no more maintained.
| 1 | 3 | 0 |
I have to write a Listener for ActiveMQ in python.
Is there any python package which could be used to write the listener.
Also what is with Stomp/Openwire protocol. When i start activemq, i see three urls with protocol namely tcp, ssl, stomp.
Any help will be appreciated
EDIT!: Another question I have is suppose we start the broker with stomp as well as openwire protocol. Lets say the broker Url is now tcp://localhost:61616 and stomp://localhost:61613. So now the broker is listening on two different ports. My question is if a producer publishes a message on tcp port will that message could be consumed by a subscriber on stomp port? Also what If two subscribers on tcp and stomp respectively are waiting on the same queue, will they both receive the message?
|
ActiveMQ Listener in Python
| 0 | 0 | 1 | 7,213 |
11,647,810 |
2012-07-25T10:33:00.000
| 1 | 1 | 0 | 1 |
python,debugging
| 11,648,687 | 1 | false | 0 | 0 |
You can compile a debug-enabled version python in your home folder without having root access and develop the C extension against that version.
| 1 | 1 | 0 |
How do I debug a Python extension written in C? I found some links that said we need to get the Python debug built, but how do we do that if we don't have root access? I have Python 2.7 installed.
|
How do I debug a Python extension written in C?
| 0.197375 | 0 | 0 | 262 |
11,649,155 |
2012-07-25T11:58:00.000
| 0 | 0 | 1 | 0 |
python,windows,package,inno-setup
| 11,848,353 | 1 | true | 0 | 0 |
You can use python together with inno. With inno you can collect all the user data which you need, and with python you can do all the other work with this user data. To do that you need to include the python files in your setup. During your setup you need to extract the files and then you can call your python scripts.
| 1 | 1 | 0 |
I know python and I am working on a project where we are using Inno setup. Is there any package builder where I can write the setup-code in python?
|
Any package builder for windows (like Inno Setup) which uses python
| 1.2 | 0 | 0 | 370 |
11,649,744 |
2012-07-25T12:29:00.000
| 0 | 1 | 1 | 0 |
c++,python,coding-style
| 11,649,914 | 3 | false | 0 | 0 |
That depends very much on the specific case.
If I were to use the file in several (sub)functions than I would rather pass the initialised file object (or function).
If I have one function to get the filename and path and another to do something with the data of the file, I would probably prefer to pass the path and filename and have the file opened by the function that uses the data.
| 2 | 1 | 0 |
In a programming language that has a file object, would you rather pass this object to a function or the path to the physical file and let the function open the file itself?
If the language does matter for your answer, please consider c++ and python.
Thanks,
Somebody
|
pass file or filename to function
| 0 | 0 | 0 | 681 |
11,649,744 |
2012-07-25T12:29:00.000
| 3 | 1 | 1 | 0 |
c++,python,coding-style
| 11,649,800 | 3 | false | 0 | 0 |
My understanding of good coding practices is to open the file where the information is to be used and not in a more global scope in any language.
| 2 | 1 | 0 |
In a programming language that has a file object, would you rather pass this object to a function or the path to the physical file and let the function open the file itself?
If the language does matter for your answer, please consider c++ and python.
Thanks,
Somebody
|
pass file or filename to function
| 0.197375 | 0 | 0 | 681 |
11,653,040 |
2012-07-25T15:19:00.000
| 4 | 0 | 0 | 0 |
python,mysql,django
| 11,653,215 | 1 | false | 1 | 0 |
You need to install the client libraries. The Python module is a wrapper around the client libraries. You don't need to install the server.
| 1 | 0 | 0 |
i am trying to connect to mysql in django. it asked me to install the module. the module prerequisites are "MySQL 3.23.32 or higher" etc. do i really need to install mysql, cant i just connect to remote one??
|
Not able to install python mysql module
| 0.664037 | 1 | 0 | 62 |
11,656,036 |
2012-07-25T18:15:00.000
| 0 | 0 | 1 | 0 |
python,ms-word,docx,doc
| 40,494,032 | 4 | false | 0 | 0 |
To keep a proper word heading format.
create a template docx file with header/footer
insert placeholders (i.e. #headerText) through Word into the docx (group the text)
expand the xml tree of the template
replace the placeholders with your desired text
output new word document
This is not an ideal solution to edit docx, but it mostly solves my python docx text insertion needs.
Eventually the python docx might add more features to help edit headers/footers.
| 2 | 3 | 0 |
I have several hundred word documents for which I need to add a specific header (as in a typical MS Word header/ footer). It is not that the header needs to be modified, these documents just don't contain one. Is there any way to do this with the Python-docx module? I recently discovered it and it seems promising.
|
Adding a header to docx file with python
| 0 | 0 | 0 | 4,102 |
11,656,036 |
2012-07-25T18:15:00.000
| 0 | 0 | 1 | 0 |
python,ms-word,docx,doc
| 38,598,493 | 4 | false | 0 | 0 |
Well if I understood, you need to create a header section in many docx files.
As far as I concern people are working on python-docx to implement this.
While this new feature is not available, you might directly add this to your docx file.
In case you don't know yet, docx files can be unzipped. Inside it's structure there are some header.xml files.
One suggestions is, create a docx file with the header, and then, using lxml and zipfile modules, you may simple update the header.xml file in all your docx files.
If you thing this could apply to help you solve you problem, let me know and i might guide you through.
Regards
| 2 | 3 | 0 |
I have several hundred word documents for which I need to add a specific header (as in a typical MS Word header/ footer). It is not that the header needs to be modified, these documents just don't contain one. Is there any way to do this with the Python-docx module? I recently discovered it and it seems promising.
|
Adding a header to docx file with python
| 0 | 0 | 0 | 4,102 |
11,656,306 |
2012-07-25T18:32:00.000
| 7 | 0 | 1 | 1 |
python,linux,cpython
| 11,656,437 | 2 | false | 0 | 0 |
By default, the keymappings are:
older: alt-p
more recent: alt-n
You can change it in Options -> Configure IDLE -> Keys -> "history-previous" and "history-next" respectively.
| 1 | 10 | 0 |
I am using a VT100 terminal emulator on Linux. In bash, up and down arrows scroll through the last commands executed; they work as expected.
Previous (up arrow) and next (down arrow) commands are not interpreted in the Python command line interpreter. What kind of key mappings do I need to make this work?
Thank you.
|
Why do up and down arrow commands not work in the Python command line interpreter?
| 1 | 0 | 0 | 6,773 |
11,657,734 |
2012-07-25T20:04:00.000
| 6 | 0 | 1 | 0 |
python,windows,sleep
| 11,657,786 | 7 | false | 0 | 0 |
0.25 seconds are 250 ms, not 25. Apart from this, there is no way to wait for exactly 25 ms on common operating systems – you would need some real-time operating system.
| 2 | 8 | 0 |
I need to wait for about 25ms in one of my functions. Sometimes this function is called when the processor is occupied with other things and other times it has the processor all to itself.
I've tried time.sleep(.25) but sometimes its actually 25ms and other times it takes much longer. Is there a way to sleep for an exact amount of time regardless of processor availability?
|
Sleep for exact time in python
| 1 | 0 | 0 | 12,004 |
11,657,734 |
2012-07-25T20:04:00.000
| 2 | 0 | 1 | 0 |
python,windows,sleep
| 11,657,821 | 7 | false | 0 | 0 |
What you intend to do is a real time application. Python (and probably the OS you are using) is not intended to program this kind of applications, where time restriction is so strict.
In order for you to achieve what you are looking for you need a RTOS (Real Time Operating System) and develop your application using a suitable programming language (usually C) following RT best practises.
| 2 | 8 | 0 |
I need to wait for about 25ms in one of my functions. Sometimes this function is called when the processor is occupied with other things and other times it has the processor all to itself.
I've tried time.sleep(.25) but sometimes its actually 25ms and other times it takes much longer. Is there a way to sleep for an exact amount of time regardless of processor availability?
|
Sleep for exact time in python
| 0.057081 | 0 | 0 | 12,004 |
11,657,757 |
2012-07-25T20:05:00.000
| 0 | 0 | 1 | 0 |
python,virtualenv,pip,virtualenvwrapper
| 11,658,449 | 2 | true | 0 | 0 |
pip-python is the name of the executable in some Linux distributions. It is on my Fedora machine.
When pip is installed in a virtualenv, the name of the executable is simply pip, not pip-python. So you need to execute it with ~/.virtualenvs/NAME/bin/pip, not ~/.virtualenvs/NAME/bin/pip-python.
| 2 | 0 | 0 |
I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.
However, when I try and install anything through pip, I'm told pip-python: command not found
I have not installed pip system wide, and was under the impression that I did not need to, given that it was already installed inside the virtual environment. Now, all this leads me to believe that something is not being set correctly with my $PATH, what could that be though? Once I'm in side the virtual environment as such: (NAME)[user@host]$ shouldn't my path already be modified to use the pip installation inside that environment? What do I need to do to make this so?
|
pip-python not found within virtual environment
| 1.2 | 0 | 0 | 4,515 |
11,657,757 |
2012-07-25T20:05:00.000
| 1 | 0 | 1 | 0 |
python,virtualenv,pip,virtualenvwrapper
| 11,657,796 | 2 | false | 0 | 0 |
You must install pip on you system to make it accessible in virtualenv.
| 2 | 0 | 0 |
I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.
However, when I try and install anything through pip, I'm told pip-python: command not found
I have not installed pip system wide, and was under the impression that I did not need to, given that it was already installed inside the virtual environment. Now, all this leads me to believe that something is not being set correctly with my $PATH, what could that be though? Once I'm in side the virtual environment as such: (NAME)[user@host]$ shouldn't my path already be modified to use the pip installation inside that environment? What do I need to do to make this so?
|
pip-python not found within virtual environment
| 0.099668 | 0 | 0 | 4,515 |
11,660,203 |
2012-07-25T23:27:00.000
| 1 | 0 | 0 | 1 |
python,osx-lion,aquamacs
| 18,509,905 | 1 | false | 0 | 0 |
I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill.
| 1 | 0 | 0 |
I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the whole computer did not help.
Other observations (that might or might not be connected):
- The script is located in a folder under Dropbox
- The file has special attributes (that is an "@" appears at the end of the permissions, upon typing ls -lah)
- I might have hit a combination of Control, Apple and other keys that I should not have ....
Any solution to this would be very much appreciated (and my apologies, if that has been treated before).
Thanks!
|
Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter"
| 0.197375 | 0 | 0 | 323 |
11,661,053 |
2012-07-26T01:22:00.000
| 0 | 0 | 1 | 1 |
python,python-idle
| 11,661,081 | 3 | false | 0 | 0 |
python.exe is Python, the python interpreter specifically.
| 1 | 0 | 0 |
I am running Windows 7 currently, and I remember when using Linux at the school computers I was able to type "gedit &" into the terminal for example to open up the gedit text editor. I was wondering whether there is a similar process to open IDLE, and for that matter a Python program/script by typing it into the "terminal-equivalent." I'm a complete newbie, so I may be off-base a bit...anyways, so there is this terminal-like program called python.exe, and it seems like it should be able to open Python-related software (like IDLE), and I was wondering 1) what python.exe is for, 2) whether it can be treated like a Linux terminal, and 3) how to do stuff in it. I've tried various commands and I get a syntax error for virtually everything. Much appreciated!
|
How to start Python IDLE from python.exe window if possible, and if not, what is python.exe even used for?
| 0 | 0 | 0 | 2,121 |
11,662,219 |
2012-07-26T04:10:00.000
| 2 | 0 | 0 | 1 |
python,linux,shell,operating-system,command
| 11,662,267 | 3 | true | 0 | 0 |
All of the things you've mentioned (which have been succeeded by the subprocess module by the way) are ways of spawning processes. You sound like you're looking for setuid. You can either call a function that will do that (e.g. os.setuid), or, as often is the case depending on what your script does, you can just run the entire script as the elevated user.
| 1 | 2 | 0 |
As far as I kown, there are about 3 ways to excute a system command in Python:
os.system(command) -> exit_status
os.popen(command [, mode='r' [, bufsize]]) -> pipe
commands.getoutput(command)-> string
Now I need to control the excutor of a system command, beside the way like:
os.system('su xxx;' + command)
is there any other more elegant way to reach the same effect?
|
Is there any way to excute a command as a specific user in Python?
| 1.2 | 0 | 0 | 814 |
11,665,765 |
2012-07-26T08:57:00.000
| 2 | 1 | 0 | 0 |
python,import
| 11,666,220 | 1 | true | 0 | 0 |
Call your script with -v option.
python -v yourscript.py
This will trace all the import statements and look or do grep for your project name. If it's not in that, then either it's not at all added to your python path or you're running different python interpreter.
| 1 | 0 | 0 |
I addded the project root of my python project to the PYTHONPATH. Now the import of my modules works in the CLI of python bot NOT in a python script.
How can I fix that?
|
Relative import works on CLI but not in script
| 1.2 | 0 | 0 | 72 |
11,668,748 |
2012-07-26T11:55:00.000
| 5 | 0 | 0 | 0 |
python,chess
| 11,668,833 | 2 | false | 0 | 0 |
Generally the unmake approach is used more as it avoids unnecessary copying of the board. This is especially true if you want to keep your pieces in two different forms in your Position class; as a traditional 8x8 array and as a set of 64-bit unsigned integers (bitboards).
You need to create a class to store your UnmakeMoveInfo which holds:
The from/to of the move.
The previous position hash.
The 'halfmove clock'.
The en-passant mask.
The captured piece.
The previous position flags (check, ep_move, castling rights).
So that you have all the info required to unmake the move.
| 1 | 4 | 0 |
I'm at the start of creating a chess engine. When I created a function that checks if a move is legal, first I had to make the move and then check if the move had put my king in check and then unmake it.
After giving some thought on how to make a function that unmakes a move, I decided it's much simpler to just copy the board and make the hypothetical move on the copied board, so it doesn't change the original board structure at all.
But I'm worried this might be a bad idea because when I get to the AI part, as I have to copy the board completely, and it might slow down my engine. Is it so? Could you please share your thoughts about this, since I don't know much about algorithm complexity and that kind of stuff.
Thank you.
|
Unmake move vs copy board in chess programming
| 0.462117 | 0 | 0 | 1,935 |
11,673,711 |
2012-07-26T16:21:00.000
| 1 | 1 | 0 | 0 |
python,boto,mechanicalturk
| 11,677,299 | 2 | true | 0 | 0 |
Looking through the MTurk API (http://docs.amazonwebservices.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html) I don't see anything that returns a list of HIT types. You should post a query to the MTurk forum (https://forums.aws.amazon.com/forum.jspa?forumID=11). It seems like a useful feature to add.
| 2 | 0 | 0 |
Is there a way to list all my HIT types (not HITs or assignments) using the mturk api?
I can't find any documentation on this. I'm using python, so it'd be nice if boto supported this query.
|
List all hitTypes through the mturk API?
| 1.2 | 0 | 1 | 362 |
11,673,711 |
2012-07-26T16:21:00.000
| 1 | 1 | 0 | 0 |
python,boto,mechanicalturk
| 11,678,042 | 2 | false | 0 | 0 |
Unfortunately there isn't. We resort to persisting every HitType locally that we create through turk's api at houdiniapi.com which works just fine.
| 2 | 0 | 0 |
Is there a way to list all my HIT types (not HITs or assignments) using the mturk api?
I can't find any documentation on this. I'm using python, so it'd be nice if boto supported this query.
|
List all hitTypes through the mturk API?
| 0.099668 | 0 | 1 | 362 |
11,674,359 |
2012-07-26T17:02:00.000
| 2 | 1 | 1 | 1 |
python
| 11,674,391 | 2 | false | 0 | 0 |
env is a program that handles these sort of things. You should pretty much always use something like #! /usr/bin/env python3 as your shebang line rather than specifying an absolute path.
| 1 | 1 | 0 |
I'm sure this is well documented somewhere, but I can't find it! I want to make my scripts portable to machines that may not have their Python interpreters in the same location. For that reason, I thought that I could just code the first line as #!python3 rather than with the absolute path to the interpreter, like #!/usr/local/bin/python3.
No doubt most of you understand why this doesn't work, but I have no idea. Although my lab mates aren't complaining about having to recode my scripts to reflect the absolute path to the interpreter on their own machines, this seems like it shouldn't be necessary. I'd be perfectly happy with a response providing a link to the appropriate documentation. Thanks in advance.
|
How to make Python script portable to machines with interpreters in different locations?
| 0.197375 | 0 | 0 | 155 |
11,674,762 |
2012-07-26T17:29:00.000
| 1 | 1 | 1 | 0 |
python,unit-testing,mocking
| 11,674,984 | 1 | false | 0 | 0 |
So, it's tough to see exactly what's going on without seeing the code, but based solely on your explanation...
I would agree with you. The behavior is what is important, not the flow of the code.
What if someone later on needs to change the flow of the code to support a different case (say, using a function with a different argument that accomplishes the same result); they can do so without breaking the existing tests.
What if you upgrade the library that is being used, and now calling the function actually has a different result than what you want? Your test still works (the function is being called), but what the unit test is actually trying to test does not.
Really, how mocks and tests are used is still a pretty young discipline. The jury is still out over whether unit testing (and the various strategies that are used in unit testing, such as mocking) are even considered "good thing". No doubt, however, I have found myself creating tests not to actually test behavior, but just so that I can say I have the test, and improper use of mocks is a great way to pretend you've created a test when really you've just created a false feeling of accomplishment that your code has now been more rigorously tested.
| 1 | 2 | 0 |
I am starting on a new project at a new job. This is my first time working heavily in Python. Mocking is a whole new beast compared to the hoops I had to jump through in a statically typed language. I took it upon myself to look into the team's unit tests and hopefully upgrade some of them from using Dingus to Mock.
Earlier today, I came across some tests that were checking a conversion class. Specifically, it converted strings of hexadecimal numbers into Mongo ObjectIds (unique identifiers). What I expected to see was a test that verified given a valid hex number, an ObjectId with same hex number would be returned -or- given a bad hex number an error would occur. Instead, all that the tests verified were that an ObjectId was created and returned. In fact, ObjectId was mocked out entirely and so was the hex number!
Now, creating an ObjectId from a string doesn't require going out to a server or anything. Everything is run locally.
I asked about this particular test suite with my new coworkers. Their thoughts were that the actual conversion should be verified using an integration test and being a unit test, all the unit test should do is make sure the code flows from top to bottom as expected and the ObjectId is created and returned. So, basically, the tests only verify that this class interacts with the environment in the expected way.
I have been writing unit tests for a long time. In my experience, I wouldn't be using mocks at all and I would just verify the conversions occurred as expected. This means interacting with the ObjectId class from another module. Perhaps my idea of a unit tests is too encompassing. I have always reserved integration tests for connecting to remote servers, files and whatnot.
The way I look at it, working with ObjectId in this example is no different than working with str or list. Sure, I can mock out str and list, but since they are essential to what my code is doing, mocking them out doesn't make much sense in my mind. The only time I should care about interacting with a dependency is when it can change the outcome of the test.
Is there any value in writing unit tests that simply check the flow of code? Shouldn't unit tests be the result of verifying the behavior/correctness of the code in mind?
|
Python Unit Testing and when to Mock
| 0.197375 | 0 | 0 | 355 |
11,675,707 |
2012-07-26T18:28:00.000
| -1 | 1 | 1 | 0 |
java,c++,python,c
| 11,675,784 | 2 | false | 0 | 0 |
Many of the STL containers in C++ are commonly implemented using trees. Examples include std::map and std::set
| 2 | 1 | 0 |
I was until now programming in C, which is a very basic language. But now as I am studying data structures, my online teacher actually uses some methods like leftChild(), rightChild(), etc.
But then I started searching whether tree ADT and such are implemented in C++, Python, Java
by default. And mostly the answers were no.
I just want to confirm whether any language supports tree ADT by default that means without downloading their classes separately.
|
built in Abstract Data Types in c++/python/java
| -0.099668 | 0 | 0 | 668 |
11,675,707 |
2012-07-26T18:28:00.000
| -1 | 1 | 1 | 0 |
java,c++,python,c
| 11,676,043 | 2 | false | 0 | 0 |
These are the basic ADTs. I think you should first learn and code them yourselves before jumping into any library with these inbuild features.
Thanks
| 2 | 1 | 0 |
I was until now programming in C, which is a very basic language. But now as I am studying data structures, my online teacher actually uses some methods like leftChild(), rightChild(), etc.
But then I started searching whether tree ADT and such are implemented in C++, Python, Java
by default. And mostly the answers were no.
I just want to confirm whether any language supports tree ADT by default that means without downloading their classes separately.
|
built in Abstract Data Types in c++/python/java
| -0.099668 | 0 | 0 | 668 |
11,678,950 |
2012-07-26T22:27:00.000
| 6 | 0 | 0 | 0 |
python,django,amazon-web-services,amazon-dynamodb,django-database
| 11,679,929 | 1 | true | 1 | 0 |
I think the answer is there's no easy way. Django supports relational databases, but DynamoDB is NoSQL.
There doesn't appear to be a backend for django-nonrel, an unofficial fork for non relational databases.
If you want to use amazon to host the database, you could use their RDS service and configure Django as you would for MySQL.
| 1 | 8 | 0 |
Is it possible to set up an AWS DynamoDB as the database backed for a Django server?
If so, how would I go about doing this?
thanks!
|
Django DynamoDB Database backend
| 1.2 | 0 | 0 | 6,014 |
11,681,354 |
2012-07-27T04:15:00.000
| 1 | 0 | 0 | 1 |
python,google-app-engine,google-cloud-datastore
| 11,681,451 | 1 | true | 1 | 0 |
I found the answer: db.allocate_id_range(...)
| 1 | 0 | 0 |
Is it possible to tell AppEngine Datastore to reserve a range of IDs, which should never be allocated to models?
|
AppEngine datastore reserve ID range
| 1.2 | 0 | 0 | 178 |
11,681,557 |
2012-07-27T04:42:00.000
| 4 | 0 | 0 | 0 |
python,google-app-engine,twitter-bootstrap,blogs
| 20,403,908 | 4 | false | 1 | 0 |
In addition to the answers above, also note that the order of declarations is important. The - url: /.* part should be the last one, in this case
| 1 | 7 | 0 |
So I'm a programming noob. I have been following many of the Udacity classes and I am slowly learning to code.
Alright so here's my question. I have built the basic HTML files of my blog using Twitter Bootstrap as it is so simple to use. Now what I would like to do is to combine the great template's that Bootstrap provides with the simple hosting services of Google App Engine. This is where my noobness comes in and I'm totally lost.
Any help would be appreciated, don't be afraid to hurt my feelings I am noob and will understand if this is completely impossible.
|
Twitter Bootstrap Website Deployed with GAE
| 0.197375 | 0 | 0 | 9,488 |
11,681,940 |
2012-07-27T05:25:00.000
| 1 | 0 | 1 | 0 |
python-2.7,nonetype
| 12,072,782 | 1 | false | 0 | 0 |
None is a singleton object of type NoneType, but like any other object (well, any one without an odd __eq__ method), it's not equal to its type.
The equivalent check would be type(function()) == type(None), or, since type-checking is a bit silly in this case, function() is None.
| 1 | 0 | 0 |
I have a function that doesn't return anything, and when I write type(function()) I get type NoneType. But when type(function()) == None, the feedback is False. Why does this happen?
|
NoneType object returns False when equated to None
| 0.197375 | 0 | 0 | 475 |
11,684,796 |
2012-07-27T09:10:00.000
| 1 | 0 | 0 | 0 |
python
| 11,684,911 | 1 | false | 0 | 1 |
these are two different widget libraries.
TkInter is built-in, however, as far as I remember, it translates python statements to tcl statements, which might not make it fast. It's also looking like a tcl/tk application on all platforms.
wxpython is NOT built-in, therefore you have to distribute it with your code to all platforms, albeit it 'blends in' a bit more perhaps.
It depends on your needs of course.
I've seen a lot of apps using XULRunner with python, examples are Miro and Songbird, but there are ones which are using gnome/gtk as well I guess.
Depends on which platforms do you want to support...
| 1 | 0 | 0 |
Can anybody explain me difference between wxpython and tkinter?
Which one is the best for development?
I want to develop a media player using python.
|
Difference between wxpython and tkinter
| 0.197375 | 0 | 0 | 1,691 |
11,686,311 |
2012-07-27T10:48:00.000
| 5 | 0 | 0 | 0 |
python,pyramid
| 11,689,231 | 1 | true | 0 | 0 |
Pyramid does not call NewRequest more than once per request. The only reason this would happen is if you are registering your subscriber multiple times accidentally. Another common reason people think it is called multiple times is that the browser usually follows requests with a favicon request, but that only accounts for 2 invocations. Can you show any output or describe your problem more to convince me that the subscriber really is being invoked more than once?
BeforeRender will be called multiple times (once for every template rendered). When the debug toolbar is enabled there is a lot of stuff being rendered on each request but even then 30 sounds more like 3 times what I would expect.
It's not a good idea to connect to your database in a NewRequest subscriber, in general, because that subscriber is invoked for static resources as well (literally all requests). A better pattern is to create a lazy/reified property on the request object via config.set_request_property. This will connect the first time you use the database in each request, and have no performance penalty when you do not.
| 1 | 0 | 0 |
It was interesting to me and I've checked it. As you can read NewRequest subscribers are called 3 times on each request (or 7 times with debug_toolbar enabled...) while BeforeRender subscribers are called 1 time on each request (> 30 times with debug_toolbar enabled).
So, if I want to connect mongodb to my project through NewRequest event it will be done 3 times for each request...
Why is that? Why should server do the same job 3 times on each request?
Thanks in advance!!!
|
Pyramid: why NewRequest subscribers calls 3 times on every request?
| 1.2 | 0 | 0 | 400 |
11,687,183 |
2012-07-27T11:49:00.000
| 1 | 1 | 1 | 0 |
python,string,int,type-conversion,performance
| 11,687,359 | 3 | false | 0 | 0 |
I don't really know what you exactly mean by "compare", but if it is not always only strict egality you'd better work with integers. You could need to sort your data or whatever, and it will be easier this way !
| 1 | 3 | 0 |
I'm currently writing a script, which at some point needs to compare numbers provided to the script by two different sources/inputs. One source provides the numbers as integers and one source provides them as strings. I need to compare them, so I need to use either str() on the integers or int() on the strings.
Assuming the amount of conversions would be equal, would it be more efficient to convert the strings into integers or vice versa?
|
More efficient to convert string to int or inverse?
| 0.066568 | 0 | 0 | 2,669 |
11,688,397 |
2012-07-27T13:08:00.000
| 0 | 0 | 0 | 0 |
php,python,node.js,asynchronous,real-time
| 11,688,432 | 4 | false | 1 | 0 |
You could use a poll, long-poll or if you want a push system. Easiest would be a poll. However, all solutions require client side coding.
Performance impact depends on your solution. Easiest to implement would be a poll. A poll with short frequency does effectively a request every, say 100ms ot simulate real time. A long-poll would be of less impact, but it would keep open a lot of request during a more or less time.
| 1 | 8 | 0 |
How to show continuous real time updates in browser like facebook ticker, meetup.com home page does? In python, PHP, node.js and what would be the performance impact at the server side ?
Also how could we achieve the same update thing if the page is cached by an CDN like akamai?
|
How to show continuous real time updates like facebook ticker, meetup.com home page does?
| 0 | 0 | 1 | 5,085 |
11,689,223 |
2012-07-27T13:53:00.000
| 0 | 0 | 1 | 1 |
python,unicode,utf-8,filesystems,iso-8859-1
| 11,835,980 | 2 | false | 0 | 0 |
Use character encoding detection, chardet modules for python work well for determining actual encoding with some confidence. "as appropriate" -- You either know the encoding or you have to guess at it. If with chardet you guess wrong, at least you tried.
| 1 | 0 | 0 |
I have an application written in Python 2.7 that reads user's file from the hard-drive using os.walk.
The application requires a UTF-8 system locale (we check the env variables before it starts) because we handle files with Unicode characters (audio files with the artist name in it for example), and want to make sure we can save these files with the correct file name to the filesystem.
Some of our users have UTF-8 locales (therefore a UTF-8 fs), but still somehow manage to have ISO-8859-1 files stored on their drive. This causes problems when our code tries to os.walk() these directories as Python throws an exception when trying to decode this sequence of ISO-8859-1 bytes using UTF-8.
So my question is, how do I get python to ignore this file and move on to the next one instead of aborting the entire os.walk(). Should I just roll my own os.walk() function?
Edit: Until now we've been telling our users to use the convmv linux command to correct their filenames, however many users have various different types of encodings (8859-1, 8859-2, etc.), and using convmv requires the user to make an educated guess on what files have what encoding before they run convmv on each one individually.
|
Python, UTF-8 filesystem, iso-8859-1 files
| 0 | 0 | 0 | 1,707 |
11,691,039 |
2012-07-27T15:32:00.000
| 2 | 0 | 0 | 1 |
python,pyodbc,opensuse
| 11,691,895 | 2 | true | 0 | 0 |
I don't see a way around having the Python header files (which are part of python-devel package). They are required to compile the package.
Maybe there was a pre-compiled egg for the 64bit version somewhere, and this is how it got installed.
Why are you reluctant to install python-devel?
| 1 | 1 | 0 |
when I try to install the pyodbc by using "python setup.py build install", it shows up with some errors like the following:
gcc -pthread -fno-strict-aliasing -DNDEBUG -march=i586 -mtune=i686 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC -DPYODBC_VERSION=3.0.3 -I/usr/include/python2.6 -c /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp -o build/temp.linux-i686-2.6/root/Desktop/pyodbc-3.0.3/src/sqlwchar.o -Wno-write-strings
In file included from /root/Desktop/pyodbc-3.0.3/src/sqlwchar.cpp:2:
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:41:20: error: Python.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:42:25: error: floatobject.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:43:24: error: longobject.h: No such file or directory
/root/Desktop/pyodbc-3.0.3/src/pyodbc.h:44:24: error: boolobject.h: No such file or directory
and few more lines with similar feedback, in the end of the reply is like:
/root/Desktop/pyodbc-3.0.3/src/pyodbccompat.h:106: error: expected ‘,’ or ‘;’ before ‘{’ token
error: command 'gcc' failed with exit status 1
and I have searched around for the solutions, everyone says to install python-devel and it will be fine, but I got this working on a 64bit opensuse without the python-devel,but it doesn't work on the 32bit one, and I couldn't found the right version for python2.6.0-8.12.2 anywhere on the internet... so I'm quite confused, please help! thanks in advance.
|
Error when installing pyodbc on opensuse
| 1.2 | 1 | 0 | 4,644 |
11,691,351 |
2012-07-27T15:51:00.000
| 1 | 0 | 0 | 1 |
python,unix,cron,tkinter,crontab
| 11,691,425 | 1 | false | 0 | 0 |
In most modern Linux distros like Debian or Ubuntu, you can add an executable file (like a shell script or a symlink to one) into /etc/cron.weekly and it will be automatically run once a week for you. This is using the anacron command, which is fairly common these days.
| 1 | 2 | 0 |
Through an application I have made with Tkinter, I'm trying to add a command to run a script every week. When the program is closed the command should be in forever place.
I've sifted through the documentation on cron, but there doesn't seem to be a way to edit the crontab without using the shell. Also I've looked through the 'at' command, but that only seems to run once.
My question is - How can one create a weekly recurring task by issuing a single command in Python on Unix?
If not with only 1 command, can I use multiple?
|
Creating a Scheduled task in Tkinter on Unix
| 0.197375 | 0 | 0 | 355 |
11,693,047 |
2012-07-27T17:50:00.000
| 55 | 0 | 1 | 0 |
c++,python,visual-studio-2010,swig
| 11,732,619 | 1 | true | 0 | 0 |
Step-by-step instructions. This assumes you have the source and are building a single DLL extension that links the source directly into it. I didn't go back through it after creating a working project, so I may have missed something. Comment on this post if you get stuck on a step. If you have an existing DLL and want to create a Python extension DLL that wraps it, this steps are slightly different. If you need help with that comment on this post and I will extend it.
Edit 8/19/2012: If starting with a C example, don't use -c++ in step 13 and use .c instead of .cxx for the wrap file extension in steps 14 and 19.
Start Visual Studio 2010
File, New, Project from Existing Code...
Select "Visual C++" project type and click Next.
Enter project file location where the .cpp/.h/.i files are.
For Project Name, choose the name used in %module statement in your .i file (case matters).
Select project type "Dynamically linked library (DLL) project" and click Next.
Add to Include search paths the path to the Python.h file, usually something like "C:\Python27\include" and click Next.
Click Finish.
Right-click the Project in Solution Explorer, Add, Existing Item..., and select your .i file.
Right-click the .i file, Properties, and select Configuration "All Configurations".
Change Item Type to "Custom Build Tool" and click Apply.
Select "Custom Build Tool" in Properties (it will appear after Apply above).
Enter Command Line of "swig -c++ -python -outdir $(Outdir) %(Identity)" (this assumes SWIG is in your path and redirects the generated .py file to the Debug or Release directory as needed).
In Outputs enter "%(Filename)_wrap.cxx;$(Outdir)%(Filename).py".
Click OK.
Right-click the .i file, and select Compile.
Right-click the project, Add, New Filter, name it "Generated Files".
Right-click "Generated Files", click Properties, and set "SCC Files" to "False" (if you use source-control, this prevents VS2010 trying to check in the generated files in this filter).
Right-click "Generated Files", Add, Exiting Item and select the _wrap.cxx file that was generated by the compile.
Right-click the project, Properties.
Select Configuration "All Configurations".
Select Configuration Properties, Linker, General, Additional Library Directories and add the path to the python libraries, typically "C:\Python27\libs".
Select Configuration Properties, General and set TargetName to "_$(ProjectName)".
Set Target Extension to ".pyd".
Build the "Release" version of the project. You can't build the Debug version unless you build a debug version of Python itself.
Open a console, go to the Release directory of the project, run python, import your module, and call a function!
| 1 | 22 | 0 |
I've been trying for weeks to get Microsoft Visual Studio 2010 to create a DLL for me with SWIG. If you have already gone through this process, would you be so kind as to give a thoughtful step-by-step process explanation? I've looked everywhere online and have spent many many hours trying to do this; but all of the tutorials that I have found are outdated or badly explained.
I have succeeded in going through this process with cygwin; but as some of you know, a cygwin DLL is not very practical.
As a result, I have .i, .cpp, and .h files that I know can create a DLL together. I just need to know how to do this with Visual Studio C++ 2010. The language that I am targeting is Python.
|
How to create a DLL with SWIG from Visual Studio 2010
| 1.2 | 0 | 0 | 14,880 |
11,694,213 |
2012-07-27T19:11:00.000
| 0 | 0 | 0 | 0 |
wxpython
| 11,722,723 | 1 | false | 0 | 1 |
You could use a wx.TextCtrl with the TE_RICH style flag and set it up so it doesn't have any borders. Or you could use the HTMLWindow.
| 1 | 0 | 0 |
How to create a readonly multicolored text widget like a StyledTextCtrl, but without scrollbars, borders etc? It should be just a widget that allows to paint different parts of text by different colors, nothing more...
Maybe wxPython is not the best solution for it?
|
wxPython: Create multicolored text widget for ASCII game
| 0 | 0 | 0 | 111 |
11,695,649 |
2012-07-27T21:06:00.000
| 1 | 0 | 0 | 0 |
python,pyqt4,qthread,python-multithreading
| 11,695,734 | 2 | false | 0 | 1 |
This is a really bad plan. Split up the 'before thread action' and 'after thread action'. The 'after thread action' should be a slot fired by a QueuedConnection that the thread can signal.
Do not wait in GUI event handlers!
| 2 | 1 | 0 |
I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code.
The solution that immediately comes to my mind is to have the thread emit a signal when complete (as I understand, QThreads already do this), and then look for this signal in the main window before the rest of the code is executed. Is this hacked?
I know QThread provides the wait() function described here , but the usage is unclear to me. I think I want to call this on the main thread, but I'm not sure how to call that in my app...?
|
How do I tell my main GUI to wait on a worker thread?
| 0.099668 | 0 | 0 | 330 |
11,695,649 |
2012-07-27T21:06:00.000
| 0 | 0 | 0 | 0 |
python,pyqt4,qthread,python-multithreading
| 11,695,743 | 2 | false | 0 | 1 |
If the GUI thread called the wait() function on the worker thread object, it would not return from it until the worker thread returns from its main function. This is not what you want to do.
The solution you describe using signal and slots seems to make plenty of sense to me. Or you could just use a boolean.
| 2 | 1 | 0 |
I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code.
The solution that immediately comes to my mind is to have the thread emit a signal when complete (as I understand, QThreads already do this), and then look for this signal in the main window before the rest of the code is executed. Is this hacked?
I know QThread provides the wait() function described here , but the usage is unclear to me. I think I want to call this on the main thread, but I'm not sure how to call that in my app...?
|
How do I tell my main GUI to wait on a worker thread?
| 0 | 0 | 0 | 330 |
11,696,472 |
2012-07-27T22:28:00.000
| 2 | 0 | 1 | 0 |
python
| 58,792,847 | 4 | false | 0 | 0 |
For strings, forget about using WHENCE: use f.seek(0) to position at beginning of file and f.seek(len(f)+1) to position at the end of file. Use open(file, "r+") to read/write anywhere in a file. If you use "a+" you'll only be able to write (append) at the end of the file regardless of where you position the cursor.
| 2 | 148 | 0 |
Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual meaning of what it does, any explanations are much appreciated, thank you.
|
seek() function?
| 0.099668 | 0 | 0 | 177,654 |
11,696,472 |
2012-07-27T22:28:00.000
| 47 | 0 | 1 | 0 |
python
| 11,696,525 | 4 | false | 0 | 0 |
When you open a file, the system points to the beginning of the file. Any read or write you do will happen from the beginning. A seek() operation moves that pointer to some other part of the file so you can read or write at that place.
So, if you want to read the whole file but skip the first 20 bytes, open the file, seek(20) to move to where you want to start reading, then continue with reading the file.
Or say you want to read every 10th byte, you could write a loop that does seek(9, 1) (moves 9 bytes forward relative to the current positions), read(1) (reads one byte), repeat.
| 2 | 148 | 0 |
Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual meaning of what it does, any explanations are much appreciated, thank you.
|
seek() function?
| 1 | 0 | 0 | 177,654 |
11,697,289 |
2012-07-28T00:47:00.000
| 5 | 0 | 0 | 0 |
python,try-catch,urllib2,urllib
| 11,697,336 | 3 | true | 0 | 0 |
There are only two exceptions you'll see, HTTPError (HTTP status codes) and URLError (everything that can go wrong), so it's not like it's overkill handling both of them. You can even just catch URLError if you don't care about status codes, since HTTPError is a subclass of it.
| 1 | 5 | 0 |
I'm working with urllib and urllib2 in python and am using them to retrieve images from urls.
Using something similar to :
try:
buffer=urllib2.url_open(urllib2.Request(url))
f.write(buffer)
f.close
except (Errors that could occur): #Network Errors(?)
print "Failed to retrieve "+url
pass
Now what happens often is that the image does not load/is broken when using the site via a normal web browser this is presumably because of high server load or because the image does not exist or could not be retrieved by the server.
Whatever the reason may be, the image does not load and a similar situation can also/is likely to occur when using the script. Since I do not know what error it might it throw up how do I handle it?
I think mentioning all possible errors in the urllib2,urllib library in the except statement might be overkill so I need a better way.
(I also might need to/have to handle broken Wi-Fi, unreachable server and the like at times so more errors)
|
Python: trying to raise multi-purpose exception for multiple error types
| 1.2 | 0 | 1 | 1,816 |
11,697,457 |
2012-07-28T01:22:00.000
| 2 | 0 | 0 | 0 |
php,python,http,header,hit
| 11,697,490 | 2 | false | 1 | 0 |
The best way to do it is pattern-recognition, since most proxies won't tell you that they are a proxy: if you see certain spikes of traffic, flag them and don't add them to the hitcount.
Alternatively, if (s)he's using the same proxies over and over again, just blacklist those IP addresses. You could also try to detect proxies by using some sort of API proxy list service or checking for listening proxy servers.
| 1 | 4 | 0 |
I am making a social site where users can post content and the content has views. Whenever a user from a different IP address views the content, the view count is incremented; multiple requests coming from the same IP address do not count. However lately someone is iterating though a list of proxies or something and artificially increasing the view counts. How can I prevent this? Is there something I can do by checking headers or something? Thanks.
|
How can I prevent my website from being "hit-boosted"?
| 0.197375 | 0 | 1 | 216 |
11,700,172 |
2012-07-28T10:24:00.000
| 3 | 1 | 0 | 1 |
python,reboot
| 11,700,297 | 1 | false | 0 | 0 |
It's not about python but rather about your whole system config. In given conditions I suggest you to split your script on 2 parts. First part is doing 1..3 and storing some extra info you're required onto persistent storage other than the fs you're experimenting on. The second part is invoked on each OS os start, reads some data stored by first part and then performs checking actions 4..5. It seems to be the most obvious and simple way.
| 1 | 0 | 0 |
I want to write a test script in python which should reboot the system in between the test execution on local machine... (No remote automation server is monitoring the script). How the script execution can be made continuous even after reboot? The script covers following scenario...
Create a Volume on some disk
Create a filesystem and mount the file system temporary
Reboot the system
Verify if filesystem is mounted
Mount the filesystem again.
|
How to continue the python script execution from the point it left before reboot
| 0.53705 | 0 | 0 | 1,400 |
11,701,887 |
2012-07-28T14:30:00.000
| 5 | 0 | 0 | 0 |
python,database,django,settings,local
| 11,702,027 | 2 | true | 1 | 0 |
You can hold 2 different settings.py and while run manage.py do :
python manage.py runserver --settings=[projectname].[settingsfile].
change the settingsfile according to your database.
| 1 | 5 | 0 |
i have different configurations for django database in settings, one named "default" and one named "clean".
How i can run the development server (python manage.py runserver ip:port) binding the "clean" database setting and not the default?
|
How to launch Django development server with a different database setting (not default)
| 1.2 | 0 | 0 | 1,173 |
11,701,920 |
2012-07-28T14:35:00.000
| 1 | 1 | 0 | 0 |
python,pyramid
| 13,202,389 | 3 | false | 0 | 0 |
Also check the response status code: response.status_int
I use it for example, to introspect my internal URIs and see whether or not a given relative URI is really served by the framework (example to generate breadcrumbs and make intermediate paths as links only if there are pages behind)
| 1 | 5 | 0 |
I need to call GET, POST, PUT, etc. requests to another URI because of search, but I cannot find a way to do that internally with pyramid. Is there any way to do it at the moment?
|
Pyramid subrequests
| 0.066568 | 0 | 1 | 552 |
11,703,407 |
2012-07-28T17:57:00.000
| 0 | 0 | 0 | 0 |
python,django,gis,postgis,geodjango
| 11,703,980 | 3 | false | 0 | 0 |
Use the appropriate data connection to execute the SQL function that you're already using, then retrieve that... Keeps everything consistent.
| 1 | 2 | 0 |
I'm writing an application that makes heavy use of geodjango (on PostGis) and spatial lookups. Distance queries on database side work great, but now I have to calculate distance between two points on python side of application (these points come from models obtained using separate queries).
I can think of many ways that would calculate this distance, but I want to know do it in manner that is consistent with what the database will output.
Is there any magic python function that calculates distance between two points given in which SRID they are measured? If not what other approach could you propose.
|
How to calculate distance between points on python side of my application in way that is consistent in what database does
| 0 | 1 | 0 | 1,898 |
11,705,114 |
2012-07-28T22:20:00.000
| 0 | 0 | 0 | 0 |
python,mysql,vim,encoding,smart-quotes
| 18,619,898 | 4 | false | 0 | 0 |
Are all these "junk" characters in the range <80> to <9F>? If so, it's highly likely that they're Microsoft "Smart Quotes" (Windows-125x encodings). Someone wrote up the text in Word or Outlook, and copy/pasted it into a Web application. Both Latin-1 and UTF-8 regard these characters as control characters, and the usual effect is that the text display gets cut off (Latin-1) or you see a ?-in-black-diamond-invalid-character (UTF-8).
Note that Word and Outlook, and some other MS products, provide a UTF-8 version of the text for clipboard use. Instead of <80> to <9F> codes, Smart Quotes characters will be proper multibyte UTF-8 sequences. If your Web page is in UTF-8, you should normally get a proper UTF-8 character instead of the Smart Quote in Windows-125x encoding. Also note that this is not guaranteed behavior, but "seems to work pretty consistently". It all depends on a UTF-8 version of the text being available, and properly handled (i.e., you didn't paste into, say, gvim on the PC, and then copy/paste into a Web text form). This may well also work for various PC applications, so long as they are looking for UTF-8-encoded text.
| 1 | 1 | 1 |
I am reading a bunch of strings from mysql database using python, and after some processing, writing them to a CSV file. However I see some totally junk characters appearing in the csv file. For example when I open the csv using gvim, I see characters like <92>,<89>, <94> etc.
Any thoughts? I tried doing string.encode('utf-8') before writing to csv but that gave an error that UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 905: ordinal not in range(128)
|
Junk characters (smart quotes, etc.) in output file
| 0 | 1 | 0 | 1,903 |
11,705,563 |
2012-07-28T23:45:00.000
| 3 | 0 | 1 | 0 |
python,utf-8,ascii
| 11,705,594 | 2 | false | 0 | 0 |
UTF-8 is an extension of ASCII in that valid 7-bit ASCII text is also valid UTF-8 text, so if all the data is in fact representable in ASCII it doesn't make any difference whether it's ASCII or UTF-8.
If the data coming is UTF-8 encoded, the best approach is to decode it to unicode objects. For example if you read in a string from some source and store it in the variable utf8str, you can do utf8str.decode('utf-8'). Then pass this unicode object around and do all your operations on the unicode object. Instead of string.translate you can use unicode.translate (assuming you're referring to the string method called "translate" there).
If your modules cannot deal with unicode strings, you need to think about how you want to handle that. You have to decide what to do if your input contains characters that can't be represented in ASCII.
| 1 | 2 | 0 |
I'm using the python module requests to get data from some API's and they all return json data which are converted to dicts. What I want to do is take some info from these dicts and either convert them all to python strings where I can use the stemming and string.translate() modules on them, or convert the whole thing to data that is recognisable to these modules. I can't do this with the UTF-8 data and it's doing my head in. Is there any solution to this at all? Can I iterate through the dict and convert it to ASCII?
The strange thing is I am comparing ASCII strings to the UTF data in other functions (if ASCII-word is in UTF dict: do something) and it works perfectly. The ASCII value matches the UTF-8 data all the time. I can't get my head around this encoding stuff at all
|
Processing Utf-8 data in python
| 0.291313 | 0 | 0 | 340 |
11,705,835 |
2012-07-29T00:57:00.000
| 0 | 0 | 0 | 0 |
python,regex,beautifulsoup,twill
| 11,712,834 | 2 | false | 1 | 0 |
I'd rather user CSS selectors or "real" regexps on page source. Twill is AFAIK not being worked on. Have you tried BS or PyQuery with CSS selectors?
| 1 | 3 | 0 |
I'm currently using urllib2 and BeautifulSoup to open and parse html data. However I've ran into a problem with a site that uses javascript to load the images after the page has been rendered (I'm trying to find the image source for a certain image on the page).
I'm thinking Twill could be a solution, and am trying to open the page and use a regular expression with 'find' to return the html string I'm looking for. I'm having some trouble getting this to work though, and can't seem to find any documentation or examples on how to use regular expressions with Twill.
Any help or advice on how to do this or solve this problem in general would be much appreciated.
|
Using Regular Expression with Twill
| 0 | 0 | 1 | 225 |
11,706,424 |
2012-07-29T03:31:00.000
| 0 | 0 | 0 | 0 |
python,regex,selenium,webdriver,beautifulsoup
| 11,707,106 | 2 | false | 1 | 0 |
You'd need to figure out what HTTP requests the Javascript is making, and make the same ones in your Python code. You can do this by using your favorite browser's development tools, or wireshark if forced.
| 1 | 1 | 0 |
I'm trying to get the content of a HTML table generated dynamically by JavaScript in a webpage & parse it using BeautifulSoup to use certain values from the table.
Since the content is generated by JavaScript it's not available in source (driver.page_source).
Is there any other way to obtain the content and use it? It's table containing list of tasks, I need to parse the table and identify whether specific task I'm searching for is available.
|
Get dynamic html table using selenium & parse it using beautifulsoup
| 0 | 0 | 1 | 1,222 |
11,706,501 |
2012-07-29T03:53:00.000
| 0 | 0 | 1 | 0 |
python,sorting,knuth
| 11,709,448 | 3 | false | 0 | 0 |
I ended up using a regular sorting algorithm (insertion sort) with a custom comparison operator that interrupts the sorting and progressively builds an execution plan to resume or reproduce the process.
It was ugly: the function raised an exception encapsulating the necessary information to continue sorting. Then sorting could be retried with the new information, to probably be aborted again.
As sorting attempts occur over the span of http requests, performance is not an issue for me.
| 2 | 6 | 0 |
I have to model the execution plan of sorting a list of 5 elements, in python, using the minimum number of comparisons between elements. Other than that, the complexity is irrelevant.
The result is a list of pairs representing the comparisons needed to sort the list at another time.
I know there's an algorithm that does this in 7 comparisons (between elements, always, not complexity-wise), but I can't find a readable (for me) version.
How can I sort the 5 elements in 7 comparisons, and build an "execution plan" for the sort?
PD: not homework.
|
Sorting 5 elements with minimum element comparison
| 0 | 0 | 0 | 3,674 |
11,706,501 |
2012-07-29T03:53:00.000
| 3 | 0 | 1 | 0 |
python,sorting,knuth
| 11,706,574 | 3 | false | 0 | 0 |
Well, there are 5!=120 ways how can elements be ordered. Each comparison gives you one bit of information, so you need at least k comparisons, where 2^k >= 120. You can check 2^7 = 128, so the 7 is least number of comparisons you need to perform.
| 2 | 6 | 0 |
I have to model the execution plan of sorting a list of 5 elements, in python, using the minimum number of comparisons between elements. Other than that, the complexity is irrelevant.
The result is a list of pairs representing the comparisons needed to sort the list at another time.
I know there's an algorithm that does this in 7 comparisons (between elements, always, not complexity-wise), but I can't find a readable (for me) version.
How can I sort the 5 elements in 7 comparisons, and build an "execution plan" for the sort?
PD: not homework.
|
Sorting 5 elements with minimum element comparison
| 0.197375 | 0 | 0 | 3,674 |
11,711,060 |
2012-07-29T16:51:00.000
| 1 | 1 | 0 | 1 |
python,apache
| 14,268,807 | 2 | false | 0 | 0 |
BlaXpirit's answer should solve your problem with a 500 server internal error.
It is important to note the "\n" at the end of the first print statement. You can also write it as
print("Content-Type: text/html; charset=utf-8")
print()
I was surprised to learn that writing out these headers is necessary even if your Python program is only going to do server-side work - with no response to the browser at all.
| 1 | 2 | 0 |
I put a simple python script inside the cgi-bin in apache2 and tried to execute it using the browser as follows,
"http://www.example.com/cgi-bin/test.py"
But it gives a 500 Internal sever error.
Following is the error.log in apache2.
[Sun Jul 29 22:07:51 2012] [error] (8)Exec format error: exec of '/usr/lib/cgi-bin/test.py' failed
[Sun Jul 29 22:07:51 2012] [error] [client ::1] Premature end of script headers: test.py
[Sun Jul 29 22:07:51 2012] [error] [client ::1] File does not exist: /var/www/favicon.ico
can anyone help me on this?
|
How to run a python script inside the cgi-bin of apache server?
| 0.099668 | 0 | 0 | 2,241 |
11,712,328 |
2012-07-29T19:37:00.000
| 2 | 0 | 1 | 0 |
python,machine-learning,artificial-intelligence,classification
| 11,713,517 | 2 | false | 0 | 0 |
Probably not. You'd need to do a fair bit of work to extract data in some usable form (such as names), and at the end of the day, there are probably few enough categories that it would simply be easier to manually identify a list of keywords for each category and set a parser loose on titles/descriptions.
For example, you could look through half a dozen biology apps, and realize that in the names/descriptions/whatever you have access to, the words "cell," "life," and "grow" appear fairly often - not as a result of some machine learning, but as a result of your own human intuition. So build a parser to classify everything with those words as biology apps, and do similar things for other categories.
Unless you're trying to classify the entire iTunes app store, that should be sufficient, and it would be a relatively small task for you to manually check any apps with multiple classifications or no classifications. The labor involved with using a simple parser + checking anomalies manually is probably far less than the labor involved with building a more complex parser to aid machine learning, setting up machine learning, and then checking everything again, because machine learning is not 100% accurate.
| 1 | 0 | 0 |
I'm trying to take a long list of objects (in this case, applications from the iTunes App Store) and classify them more specifically. For instance, there are a bunch of applications currently classified as "Education," but I'd like to label them as Biology, English, Math, etc.
Is this an AI/Machine Learning problem? I have no background in that area whatsoever but would like some resources or ideas on where to start for this sort of thing.
|
How to programmatically classify a list of objects
| 0.197375 | 0 | 0 | 1,258 |
11,712,629 |
2012-07-29T20:24:00.000
| 7 | 0 | 1 | 0 |
python,windows,linux,multithreading,python-multithreading
| 11,713,013 | 3 | true | 0 | 0 |
Rather than use a console or terminal window, re-examine your problem. What you are trying to do is create a GUI. There are a number of cross-platform toolkits including Wx and Tkinter that have widgets to do exactly what you want. A text box for output and an entry widget for reading keyboard input. Plus you can wrap them in a nice frame with titles, help, open/save/close, etc.
| 1 | 8 | 0 |
I am trying to make a program that will launch both a view window (console) and a command line. In the view window, it would show constant updates, while the command line window would use raw_input() to accept commands that affect the view window. I am thinking about using threads for this, but I have no idea how to launch a thread in a new console window. How would I do that?
|
Opening a Python thread in a new console window
| 1.2 | 0 | 0 | 20,795 |
11,712,767 |
2012-07-29T20:41:00.000
| 2 | 0 | 1 | 0 |
python,pipeline
| 11,712,946 | 4 | false | 0 | 0 |
Two options:
Have configuration somewhere else: have a config module, and use something like the django config system to make that available.
Instead of having the stages import the pipeline class, pass them a pipeline instance on instantiation.
| 1 | 13 | 0 |
Context: I'm currently using Python to a code a data-reduction pipeline for a large astronomical imaging system. The main pipeline class passes experimental data through a number of discrete processing 'stages'.
The stages are written in separate .py files which constitute a package. A list of available stages is generated at runtime so the user can choose which stages to run the data through.
The aim of this approach is to allow the user to create additional stages in the future.
Issue: All of the pipeline configuration parameters and data structures are (currently) located within the main pipeline class. Is there a simple way to access these from within the stages which are imported at runtime?
My current best attempt seems 'wrong' and somewhat primitive, as it uses circular imports and class variables. Is there perhaps a way for a pipeline instance to pass a reference to itself as an argument to each of the stages it calls?
This is my first time coding a large python project and my lack of design knowledge is really showing.
Any help would be greatly appreciated.
|
Designing an extensible pipeline with Python
| 0.099668 | 0 | 0 | 6,343 |
11,713,187 |
2012-07-29T21:40:00.000
| 11 | 0 | 1 | 1 |
python,virtualenv
| 11,713,237 | 2 | true | 0 | 0 |
You don't run activate as a script; you need to source it in your shell, since it affects the shell itself.
It probably also doesn't make any sense to run it under sudo.
| 1 | 2 | 0 |
I'm trying to use virtualenv on my development machine. I successfully created my new environment issuing virtualenv venv in /home/user/. When I try to activate it (from user location) with sudo venv/bin/activate I get venv/bin/activate: command not found.
|
Problems starting created virtualenv instance
| 1.2 | 0 | 0 | 9,585 |
11,713,284 |
2012-07-29T21:53:00.000
| 1 | 0 | 0 | 0 |
python,django,image
| 11,748,617 | 3 | true | 1 | 0 |
You'll first need to parse the html content for img src urls with something like lxml or BeautifulSoup. Then, you can feed one of those img src urls into sorl-thumbnail or easy-thumbnails as Edmon suggests.
| 1 | 2 | 0 |
I am pretty new to Django so I am creating a project to learn more about how it works. Right now I have a model that contains a URL field. I want to automatically generate a thumbnail from this url field by taking an appropriate image from the webite like facebook or reddit does. I'm guessing that I should store this image in an image field. What would be a good way to select an ideal image from the website and how can I accomplish this?
EDIT- I'm trying to take actual images from the website rather than a picture of the website
|
Need to create thumbnail from user submitted url like reddit/facebook
| 1.2 | 0 | 0 | 1,630 |
11,713,588 |
2012-07-29T22:35:00.000
| 3 | 0 | 0 | 0 |
python,django,static-files,django-staticfiles
| 11,713,704 | 1 | true | 1 | 0 |
The static file finders will collocate the contents of all of your static folders under a single root upon collection, which means you can reference static resources relatively.
For instance, if you had a logo in project/commons/static/images/logo.png, you can reuse it in a stylesheet in some other application, say project/myapp/static/css/myapp.css, by relatively referencing the image, i.e. ../images/logo.png.
| 1 | 1 | 0 |
I have a directory with static files myapp/static/ and within that there are static/css,static/javascript, and static/images How can these files refere to one another? For instants, the css has to use the image files for the background of certain pages. Do you have to hard code the url? Can you do it relatively?
|
Django: Static files referring to one another.
| 1.2 | 0 | 0 | 67 |
11,714,859 |
2012-07-30T02:44:00.000
| 1 | 0 | 1 | 0 |
python,python-2.7
| 47,832,414 | 3 | false | 0 | 0 |
If you want first 2 letters and last 2 letters of a string then you can use the following code:
name = "India"
name[0:2]="In"
names[-2:]="ia"
| 1 | 95 | 0 |
Hi I just started learning Python but I'm sort of stuck right now.
I have hash.txt file containing thousands of malware hashes in MD5, Sha1 and Sha5 respectively separated by delimiters in each line. Below are 2 examples lines I extracted from the .txt file.
416d76b8811b0ddae2fdad8f4721ddbe|d4f656ee006e248f2f3a8a93a8aec5868788b927|12a5f648928f8e0b5376d2cc07de8e4cbf9f7ccbadb97d898373f85f0a75c47f
56a99a4205a4d6cab2dcae414a5670fd|612aeeeaa8aa432a7b96202847169ecae56b07ee|d17de7ca4c8f24ff49314f0f342dbe9243b10e9f3558c6193e2fd6bccb1be6d2
My intention is to display the first 32 characters (MD5 hash) so the output will look something like this:
416d76b8811b0ddae2fdad8f4721ddbe 56a99a4205a4d6cab2dcae414a5670fd
Any ideas?
|
How to display the first few characters of a string in Python?
| 0.066568 | 0 | 0 | 288,488 |
11,716,677 |
2012-07-30T06:58:00.000
| 0 | 1 | 0 | 0 |
python,testing,selenium
| 11,718,057 | 1 | true | 0 | 0 |
Yes, use different browser configurations in the hub, and use two or more programs to contact the grid with different browsers
| 1 | 0 | 0 |
Can each node of selenium grid run different python script/test?
- how to setup?
|
Can each node of selenium grid run different script/test? - how to setup?
| 1.2 | 0 | 1 | 382 |
11,717,481 |
2012-07-30T08:00:00.000
| 0 | 0 | 1 | 0 |
python,python-2.7,urllib2,gevent
| 11,718,217 | 2 | false | 0 | 0 |
As we still don't know what you exactly do, I can only guess: you are opening many URLs at once, and only then you try to read them. Instead, you should/could open-read-close them and then advance to the next one.
Alternatively, you could create a concurrency capable URL loader: open some urls and try to read them concurrently. After closing one, you can start opening the next. If you limit that to 5 or 10 at once, you shouldn't get a problem any longer.
| 1 | 5 | 0 |
I have a long list of URLs I need to open for my service. Whenever I attempt to open this entire list, I receive many errors such as this when I initiate the program: [Errno 24] Too many open files. I am using urllib2 and gevent.
Does anyone have any solutions?
Thanks.
|
Python urllib2 Errors
| 0 | 0 | 0 | 817 |
11,718,410 |
2012-07-30T09:11:00.000
| 4 | 0 | 1 | 0 |
python,setuptools
| 11,718,585 | 1 | true | 0 | 0 |
This won't work with setuptools; you cannot override dependencies like that, for good reasons.
What you describe is a broken dependency; you'll have to resolve this manually (probably by pinning package A to v. 2.0).
| 1 | 2 | 0 |
Let's say I have a setuptools project that depends on
PyPi package A, v. 1.0.
PyPi package B, v. 1.0.
and package B depends on A, v. 2.0.
In Java I would have to exclude transitive dependencies in pom.xml or similar. How does it work in setuptools? Can multiple versions of the same package live together in an installation?
|
How setuptools deals with transitive dependencies?
| 1.2 | 0 | 0 | 448 |
11,719,619 |
2012-07-30T10:26:00.000
| 1 | 0 | 0 | 0 |
python,user-interface,64-bit,pywinauto
| 12,949,711 | 4 | false | 0 | 0 |
Azurin, you always can use python32bit + pywinauto on your x64 OS. If you realy need python64 you also can use py2exe to compile a test in .exe and use it everywhere, even on OSes where python is not installed. :)
| 2 | 3 | 0 |
I am using pywinauto for gui automation for quite a long time already. Now I have to move to x64 OS. There seems to be no official version for 64 bit OS. There are clones which claim they support 64, but in practice they don't.
On installation there are several assertions about wrong win structures size. If commented out, the lib manages to install, but some API doesn't work. E.g. win32functions.GetMenuItemInfo() returns Error 87: wrong parameter. This API depends on struct MENUITEMINFOW (which size initially didn't pass the assertion).
Does anybody know how to handle this situation?
Is there a pure pywinauto version to work without additional patches?
And finally, if no answer, is there a powerful Python lib you may suggest for gui automation? With a support of 64 bit?
Thanks in advance.
|
Looking for a way to use Pywinauto on Win x64
| 0.049958 | 0 | 0 | 2,889 |
11,719,619 |
2012-07-30T10:26:00.000
| -2 | 0 | 0 | 0 |
python,user-interface,64-bit,pywinauto
| 22,605,499 | 4 | false | 0 | 0 |
win32structure.py
ensure HANDLE is c_void_p
redefine other handles like HBITMAP to HANDLE
ensure pointers are pointers and not long
| 2 | 3 | 0 |
I am using pywinauto for gui automation for quite a long time already. Now I have to move to x64 OS. There seems to be no official version for 64 bit OS. There are clones which claim they support 64, but in practice they don't.
On installation there are several assertions about wrong win structures size. If commented out, the lib manages to install, but some API doesn't work. E.g. win32functions.GetMenuItemInfo() returns Error 87: wrong parameter. This API depends on struct MENUITEMINFOW (which size initially didn't pass the assertion).
Does anybody know how to handle this situation?
Is there a pure pywinauto version to work without additional patches?
And finally, if no answer, is there a powerful Python lib you may suggest for gui automation? With a support of 64 bit?
Thanks in advance.
|
Looking for a way to use Pywinauto on Win x64
| -0.099668 | 0 | 0 | 2,889 |
11,724,257 |
2012-07-30T15:09:00.000
| 3 | 0 | 0 | 1 |
python,security,subprocess,chroot,jail
| 11,725,863 | 2 | true | 0 | 0 |
After creating your jail you would call os.chroot from your Python source to go into it. But even then, any shared libraries or module files already opened by the interpreter would still be open, and I have no idea what the consequences of closing those files via os.close would be; I've never tried it.
Even if this works, setting up chroot is a big deal so be sure the benefit is worth the price. In the worst case you would have to ensure that the entire Python runtime with all modules you intend to use, as well as all dependent programs and shared libraries and other files from /bin, /lib etc. are available within each jailed filesystem. And of course, doing this won't protect other types of resources, i.e. network destinations, database.
An alternative could be to read in the untrusted code as a string and then exec code in mynamespace where mynamespace is a dictionary defining only the symbols you want to expose to the untrusted code. This would be sort of a "jail" within the Python VM. You might have to parse the source first looking for things like import statements, unless replacing the built-in __import__ function would intercept that (I'm unsure).
| 1 | 12 | 0 |
I'm writing a web server based on Python which should be able to execute "plugins" so that functionality can be easily extended.
For this I considered the approach to have a number of folders (one for each plugin) and a number of shell/python scripts in there named after predefined names for different events that can occur.
One example is to have an on_pdf_uploaded.py file which is executed when a PDF is uploaded to the server. To do this I would use Python's subprocess tools.
For convenience and security, this would allow me to use Unix environment variables to provide further information and set the working directory (cwd) of the process so that it can access the right files without having to find their location.
Since the plugin code is coming from an untrusted source, I want to make it as secure as possible. My idea was to execute the code in a subprocess, but put it into a chroot jail with a different user, so that it can't access any other resources on the server.
Unfortunately I couldn't find anything about this, and I wouldn't want to rely on the untrusted script to put itself into a jail.
Furthermore, I can't put the main/calling process into a chroot jail either, since plugin code might be executed in multiple processes at the same time while the server is answering other requests.
So here's the question: How can I execute subprocesses/scripts in a chroot jail with minimum privileges to protect the rest of the server from being damaged by faulty, untrusted code?
Thank you!
|
Python: Securing untrusted scripts/subprocess with chroot and chjail?
| 1.2 | 0 | 0 | 7,078 |
11,725,192 |
2012-07-30T16:03:00.000
| 1 | 0 | 1 | 0 |
python,multithreading,sockets,asynchronous
| 11,725,633 | 1 | true | 0 | 0 |
For a group chat application, the general approach will be:
Server side (accept process):
Create the socket, bind it to a well known port (and on appropriate interface) and listen
While (app_running)
Client_socket = accept (using serverSocket)
Spawn a new thread and pass this socket to the thread. That thread handles the client that just connected.
Continue, so that server can continue to accept more connections.
Server-side client mgmt Thread:
while app_running:
read the incoming message, and store to a queue or something.
continue
Server side (group chat processing):
For all connected clients:
check their queues. If any message present, send that to ALL the connected clients (including the client that sent this message -- serves as ACK sort of)
Client side:
create a socket
connect to server via IP-address, and port
do send/receive.
There can be lots of improvement on the above. Like the server could poll the sockets or use "select" operation on a group of sockets. That would make it efficient in the sense that having a separate thread for each connected client will be an overdose when there are many. (Think ~1MB per thread for stack).
PS: I haven't really used asyncore module. But I am just guessing that you would notice some performance improvement when you have lots of connected clients and very less processing.
| 1 | 2 | 0 |
I am developing a group chat application to learn how to use sockets, threads (maybe), and asycore module(maybe).
What my thought was have a client-server architecture so that when a client connects to the server the server sends the client a list of other connects (other client 'user name', ip addres) and then a person can connect to one or more people at a time and the server would set up a P2P connection between the client(s). I have the socket part working, but the server can only handle one client connection at a time.
What would be the best, most common, practical way to go about handling multiple connections?
Do I create a new process/thread whenever I new connection comes into the server and then connect the different client connections together, or use the asycore module which from what I understand makes the server send the same data to multiple sockets(connection) and I just have to regulate where the data goes.
Any help/thoughts/advice would be appreciated.
|
Group chat application in python using threads or asycore
| 1.2 | 0 | 1 | 1,547 |
11,725,340 |
2012-07-30T16:11:00.000
| 5 | 0 | 1 | 0 |
python,multithreading,orphan
| 11,725,777 | 2 | true | 0 | 0 |
If you can get a handle to the main thread, you can call is_alive() on it.
Alternatively, you can call threading.enumerate() to get a list of all currently living threads, and check to see if the main thread is in there.
Or if even that is impossible, then you might be able to check to see if the child thread is the only remaining non-daemon thread.
| 2 | 6 | 0 |
I have a program using a thread. When my program is closed, my thread is still running and that's normal. I would like to know how my thread can detect that the main program is terminated; by itself ONLY. How would I do that?
My thread is in an infinite loop and process many object in a Queue. I can't define my thread as a daemon, else I can lose some data at the end of the main program. I don't want that my main program set a boolean value when it closed.
|
python: How to detect when my thread become orphan?
| 1.2 | 0 | 0 | 2,406 |
11,725,340 |
2012-07-30T16:11:00.000
| 0 | 0 | 1 | 0 |
python,multithreading,orphan
| 11,725,681 | 2 | false | 0 | 0 |
Would it work if your manager tracked how many open threads there were, then the children killed themselves when starved of input? So the parent would start pushing data on to the queue, and the workers would consume data from the queue. If a worker found nothing on the queue for a certain timeout period, it would kill itself. The main thread would then track how many workers were operating and periodically start new workers if the number of active workers were under a given threshold.
| 2 | 6 | 0 |
I have a program using a thread. When my program is closed, my thread is still running and that's normal. I would like to know how my thread can detect that the main program is terminated; by itself ONLY. How would I do that?
My thread is in an infinite loop and process many object in a Queue. I can't define my thread as a daemon, else I can lose some data at the end of the main program. I don't want that my main program set a boolean value when it closed.
|
python: How to detect when my thread become orphan?
| 0 | 0 | 0 | 2,406 |
11,725,519 |
2012-07-30T16:23:00.000
| 0 | 0 | 1 | 0 |
python,pycharm
| 67,397,573 | 29 | false | 0 | 0 |
I had the same symptoms. In my instance the problem source was that I had set
idea.max.intellisense.filesize=50 in the custom properties.
I could resolve it by setting it to 100.
Help->Edit Custom Properties
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 4 | 0 | 1 | 0 |
python,pycharm
| 34,501,678 | 29 | false | 0 | 0 |
You might try closing Pycharm, deleting the .idea folder from your project, then starting Pycharm again and recreating the project. This worked for me whereas invalidating cache did not.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0.027579 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 13 | 0 | 1 | 0 |
python,pycharm
| 22,563,427 | 29 | false | 0 | 0 |
I find myself removing and re-adding the remote interpreter to fix this problem when Invalidating Caches or Refreshing Paths does not work.
I use vagrant and every once and awhile if I add a new VM to my multi-vm setup, the forwarded port changes and this seems to confuse PyCharm when it tries to use the wrong port for SSH. Changing the port doesn't seem to help the broken references.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 1 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 7 | 0 | 1 | 0 |
python,pycharm
| 27,937,500 | 29 | false | 0 | 0 |
Sorry to bump this question, however I have an important update to make.
You may also want to revert your project interpreter to to Python 2.7.6 if you're using any other version than that This worked for me on my Ubuntu installation of PyCharm 4.04 professional after none of the other recommendations solved my problem.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 1 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 12 | 0 | 1 | 0 |
python,pycharm
| 29,665,019 | 29 | false | 0 | 0 |
If none of the other solutions work for you, try (backing up) and deleting your ~/.PyCharm40 folder, then reopening PyCharm. This will kill all your preferences as well.
On Mac you want to delete ~/Library/Caches/Pycharm40 and ~/Library/Preferences/PyCharm40.
And on Windows: C:\Users\$USER.PyCharm40.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 1 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 11 | 0 | 1 | 0 |
python,pycharm
| 30,163,990 | 29 | false | 0 | 0 |
Tested with PyCharm 4.0.6 (OSX 10.10.3)
following this steps:
Click PyCharm menu.
Select Project Interpreter.
Select Gear icon.
Select More button.
Select Project Interpreter you are in.
Select Directory Tree button.
Select Reload list of paths.
Problem solved!
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 1 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 3 | 0 | 1 | 0 |
python,pycharm
| 57,279,189 | 29 | false | 0 | 0 |
None of the answers solved my problem.
What did it for me was switching environments and going back to the same environment. File->Settings->Project interpreter
I am using conda environments.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0.020687 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 1 | 0 | 1 | 0 |
python,pycharm
| 36,353,915 | 29 | false | 0 | 0 |
I closed all the other projects and run my required project in isolation in Pycharm. I created a separate virtualenv from pycharm and added all the required modules in it by using pip. I added this virtual environment in project's interpreter. This solved my problem.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0.006896 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 1 | 0 | 1 | 0 |
python,pycharm
| 39,994,591 | 29 | false | 0 | 0 |
Geeze what a nightmare, my amalgamation of different StackOVerflow answers:
Switch to local interpreter /usr/bin/pythonX.X and apply
View paths like above answer
Find skeletons path. Mine was (/home/tim/Desktop/pycharm-community-2016.2.3/helpers/python-skeletons)
Switch back to virt interpreter and add the skeletons path manually if it didn't automatically show up.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0.006896 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 1 | 0 | 1 | 0 |
python,pycharm
| 42,952,046 | 29 | false | 0 | 0 |
None of the above solutions worked for me!
If you are using virtual environment for your project make sure to apply the python.exe file that is inside your virtual environment directory as interpreter for the project (Alt + Ctrl + Shift + S)
this solved the issue for me.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0.006896 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 487 | 0 | 1 | 0 |
python,pycharm
| 11,773,462 | 29 | true | 0 | 0 |
File | Invalidate Caches... and restarting PyCharm helps.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 1.2 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 0 | 0 | 1 | 0 |
python,pycharm
| 65,300,581 | 29 | false | 0 | 0 |
I had to go to File->Invalidate Caches/Restart, reboot Ubuntu 18.04 LTS, then open Pycharm and File-> Invalidate Caches/Restart again before it cleared up.
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0 | 0 | 0 | 235,738 |
11,725,519 |
2012-07-30T16:23:00.000
| 0 | 0 | 1 | 0 |
python,pycharm
| 65,666,542 | 29 | false | 0 | 0 |
For me it helped:
update your main directory "mark Directory as" -> "source root"
| 13 | 322 | 0 |
I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Python functions. Why don't these seem to be detected, even though the code runs? Is there any way to get PyCharm to recognize these correctly?
This specific instance of the problem is with a remote interpreter, but the problem appears on local interpreters as well.
|
PyCharm shows unresolved references error for valid code
| 0 | 0 | 0 | 235,738 |
11,725,645 |
2012-07-30T16:29:00.000
| 5 | 1 | 0 | 0 |
python,pdf,latex
| 11,725,677 | 3 | true | 1 | 0 |
I would suggest using the LaTeX approach. It is cross-platform, works in many different languages and is easy to maintain. Plus it's non-commercial!
| 1 | 6 | 0 |
I'm trying to develop a small script that generate a complete new pdf, mainly text and tables, file as result.
I'm searching for the best way to do it.
I've read about reportlab, which seems pretty good. It has only one drawback asfar as I can see. It is quiet hard to write a template without the commercial version, and the code seems to be hard to maintain.
So I've searched for a more sufficient way and found xhtml2pdf, but this software is quiet old, and cannot generate tables over two pages or more.
The last solution in my mind it to generate a tex-File with a template framework, and later call pdftex as subprocess.
I would implement the last one, and go over LateX. Would you do so, have you better ideas?
|
Generate a pdf with python
| 1.2 | 0 | 0 | 3,407 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.